Revision d79d8208 README.develop
b/README.develop | ||
---|---|---|
220 | 220 |
|
221 | 221 |
You can now apply this migration with: ./manage.py migrate db |
222 | 222 |
|
223 |
bkarak@nefarian:~/devel/synnefo$ ./manage.py migrate db
|
|
223 |
$ ./manage.py migrate db |
|
224 | 224 |
Running migrations for db: |
225 | 225 |
- Migrating forwards to 0002_auto__add_field_synnefouser_new_south_test_field. |
226 | 226 |
> db:0002_auto__add_field_synnefouser_new_south_test_field |
... | ... | |
231 | 231 |
South needs some extra definitions to the model to preserve and migrate the existing data, for example, if we add a field |
232 | 232 |
in a model, we should declare its default value. If not, South will propably fail, after indicating the error. |
233 | 233 |
|
234 |
[don't understand the above, Example?] |
|
234 |
$ ./bin/python manage.py schemamigration db --auto |
|
235 |
? The field 'SynnefoUser.new_south_field_2' does not have a default specified, yet is NOT NULL. |
|
236 |
? Since you are adding or removing this field, you MUST specify a default |
|
237 |
? value to use for existing rows. Would you like to: |
|
238 |
? 1. Quit now, and add a default to the field in models.py |
|
239 |
? 2. Specify a one-off value to use for existing columns now |
|
240 |
? Please select a choice: 1 |
|
235 | 241 |
|
236 | 242 |
*Data migrations: |
237 | 243 |
|
... | ... | |
255 | 261 |
For database operations (column additions, alter tables etc) we use the South database API |
256 | 262 |
(http://south.aeracode.org/docs/databaseapi.html). |
257 | 263 |
|
258 |
To access the data, we use the database reference (orm) provided as parameter in forwards, backwards declarations. <--What does this mean?
|
|
259 |
For example: |
|
264 |
To access the data, we use the database reference (orm) provided as parameter in forwards, backwards method declarations
|
|
265 |
in the migration script. For example:
|
|
260 | 266 |
|
261 | 267 |
class Migration(DataMigration): |
262 | 268 |
|
Also available in: Unified diff