From e5ff99987b62d202bc453cddb8e7dc4a218ac64f Mon Sep 17 00:00:00 2001 From: Yasin Date: Thu, 5 Sep 2013 12:00:26 +0200 Subject: [PATCH] README: updated DB migration notes --- README | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README b/README index a38c08b7..619473b8 100644 --- a/README +++ b/README @@ -211,17 +211,36 @@ that would reset all-static/ and all-templates/ for you from the other contents ======== update django database to reflect changes in existing models without any migration system (e.g., south) ========= +# older version $python manage.py reset -#Django 1.5.1 + +#Django 1.5.1 or later $python manage.py flush This will update the database tables for your app, but will completely destroy any data that existed in those tables. If the changes you made to your app model do not break your old schema (for instance, you added a new, optional field) you can simply dump the data before and reload it afterwards, like so: - +$python manage.py syncdb $python manage.py dumpdata > temp_data.json -$python manage.py reset +$python manage.py flush $python manage.py loaddata temp_data.json If your changes break your old schema this won't work - in which case tools like south or django evolution are great. + +======== update django database to reflect changes in existing models with migration system (e.g., south) ========= + +As south is already installed , you just have to do: + +$./manage.py migrate + +if it fails: + +sqlite> DROP TABLE my_table [from your DB] + +then + +$./manage.py migrate + + + -- 2.43.0