Ticket #735 (closed defect: fixed)
Altering a column does not remove UNIQUE constraint
| Reported by: | Stephan Jaensch <sj@…> | Owned by: | andrew |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.0 |
| Component: | migrations | Version: | mercurial |
| Keywords: | Cc: |
Description
Using the Oracle backend, I have a migration modifying a column that has a UNIQUE constraint. The new column definition in the alter_column() call does not specify unique=True, but the constraint is not actually dropped.
Note that the other way around works just fine, namely altering a column and adding a UNIQUE constraint to it.
Attachments
Change History
comment:2 Changed 2 years ago by Stephan Jaensch <sj@…>
These two changesets improve/fix constraint cache handling and make sure UNIQUE constraints are handled correctly during alter_column():
https://bitbucket.org/sjaensch/south/changeset/2a6f7bc2b8b9
https://bitbucket.org/sjaensch/south/changeset/2262cdf3a10f
This changeset implements a new testcase for this bug:
https://bitbucket.org/sjaensch/south/changeset/8c048cebe9b0
comment:3 Changed 2 years ago by sj@…
The new testcase did fail for PostgreSQL for two reasons. This changeset implements proper transaction handling:
https://bitbucket.org/sjaensch/south/changeset/20e16402bf3e
The second changeset implements UNIQUE constraint creation/deletion for alter_column() in the generic backend the same way the Oracle backend does it:
https://bitbucket.org/sjaensch/south/changeset/c5ff4ec6fe0c
Now PostgreSQL passes the test too. I did not test with MySQL or SQLite.
