Revision 55175e78
b/README.develop | ||
---|---|---|
192 | 192 |
|
193 | 193 |
*Initial Migration |
194 | 194 |
|
195 |
*Schema migrations: |
|
196 |
|
|
197 | 195 |
First, remember to add the south app to settings.py (it is already included in the |
198 | 196 |
settings.py.dist). |
199 | 197 |
|
200 |
In addition, do not use the syncdb management command. It can only be used |
|
201 |
the first time and/or if you drop the database and must recreate it from scratch. |
|
198 |
To initialise south migrations in your database the following commands must be executed: |
|
199 |
|
|
200 |
$ ./bin/python manage.py syncdb # Create / update the database with the south tables |
|
201 |
$ ./bin/python manage.py migrate db # Perform migration in the database |
|
202 |
|
|
203 |
Note that syncdb will create the latest models that exist in the db app, so some migrations may fail. |
|
204 |
If you are sure a migration has already taken place you must use the "--fake" option, to apply it. |
|
205 |
|
|
206 |
For example: |
|
207 |
|
|
208 |
$ ./bin/python manage.py migrate db 0001 --fake |
|
202 | 209 |
|
203 |
The first schema support for migrations is initialized with the following |
|
204 |
command: |
|
210 |
To be sure that all migrations are applied type: |
|
205 | 211 |
|
206 |
$ ./bin/python schemamigration db --initial |
|
212 |
$ ./bin/python manage.py migrate db --list |
|
213 |
|
|
214 |
All starred migrations are applied. |
|
215 |
|
|
216 |
Remember, the migration is performed mainly for the data, not for the database schema. If you do not want to migrate the |
|
217 |
data, a syncdb and fake migrations for all the migration versions will suffice. |
|
218 |
|
|
219 |
*Schema migrations: |
|
220 |
|
|
221 |
Do not use the syncdb management command. It can only be used |
|
222 |
the first time and/or if you drop the database and must recreate it from scratch. |
|
223 |
See "Initial Migration" section. |
|
207 | 224 |
|
208 | 225 |
Each time you make changes to the database and data migration is not required (WARNING: always |
209 | 226 |
perform this with extreme care): |
Also available in: Unified diff