I'm reading South's documentation about how to convert an app.

I don't understand the 0001 part inside the example ./manage.py migrate myapp 0001 --fake, because it seems there are no references in the docs about the meaning of this 4-digit number.

Can someone explain this to me?

有帮助吗?

解决方案

According to the documentation, it is just a shortcut, to save typing.

If you check your migrations directory, you would see a python file called: 0001_migration_name.py. South simply provides you a way to run the migration by specifying only digits, a prefix of the migration name.

Note that if you would run ./manage.py migrate myapp 000 while having several migrations, e.g.:

0001_initial_migration
0002_add_username

you would receive an error, since south would not identify a single unique migration by the prefix you've provided.

FYI, here is the source code of guess_migration(), that tries to match the migration by prefix.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top