0

In the South Docs,when changing the name of a field it wants you to use ./manage.py schemamigration southtut --auto --update. When I use it I get the following./manage.py: error: no such option: --update. also when checking the possible options I can use update is not in there.

options given:

--add-field= --add-model= --empty --help --pythonpath= --stdout --verbosity= --add-index= --auto --freeze= --initial --settings= --traceback

Brandon Nadeau
  • 3,568
  • 13
  • 42
  • 65

1 Answers1

2

Is simple, do it without --update. When you issue schemamigration southtut --auto it should automatically acknowledge the changes and notice that a field has changed a name and do what it has to.

It has worked for me.

Besides what --update does is update the last migration instead of creating a new one so is probably not what you want. What you want is to change the schema.

If you want to rename a field in the model, you probably will have to dome something like create a migration that add the new field with the new name, then create a data migration to add the data from the old field (the one you wanna change the name) to the new field (the one with the new name) and then create a third migration to remove the old column.

You can search how to do data migration in the south doc.

You can try also what it is in this very good answer. It might be simpler.

Hope it helps.

Community
  • 1
  • 1
Paulo Bu
  • 29,294
  • 6
  • 74
  • 73
  • I tried but, my column names haven't changed with just that, am I doing something wrong? – Brandon Nadeau May 08 '13 at 22:32
  • When you issued the command, what does it said? When it detects that nothing has changed South says something like: "No changes". If not, it will do the changes. What was the output of the command? – Paulo Bu May 08 '13 at 22:36
  • well it said it deleted the column(a) and made a new one(b), but when I go to create a model object it says the column that was supposed to be deleted(a) cant be null? – Brandon Nadeau May 08 '13 at 22:40
  • Added some more info about field renaming in my answer. Hope it helps. – Paulo Bu May 08 '13 at 22:48