2👍
Generate the new migration using:
python manage.py makemigrations
The above will detect changes to your model and generate a migration class but no execute any sql yet.
To generate/apply the sql to the db:
python manage.py migrate
If you want to see the sql that will be executed before updating the db do this before migrate
:
python sqlmigrate {app_label} {migration_module}
EDIT: The above will rename your table with suffix __old
, create a new table and insert the data from the old to the new one, and then drop the original table. So not sure if this is what you want..
Another option would be to use plain sql to achieve what you want:
ALTER TABLE table_name DROP CONSTRAINT constraint_name;
But remember, in order keep your migrations updated for new runs, find the migration class that declares your field as unique and change unique=True
to unique=False
. If any other servers need to be updated you can run the drop constraint command there too so everything is in sync.
1👍
Just change the value to False in the model and then makemigrations and migrate. This will update all items in the DB to the new value. This is if you are using the newer version with South and not using syncdb.