Ticket #735 (closed defect: fixed)

Opened 5 years ago

Last modified 16 months ago

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:


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.

Change History

comment:1 Changed 5 years ago by andrew

  • Milestone set to 1.0

comment:2 Changed 5 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():


This changeset implements a new testcase for this bug:


comment:3 Changed 5 years ago by sj@…

The new testcase did fail for PostgreSQL for two reasons. This changeset implements proper transaction handling:


The second changeset implements UNIQUE constraint creation/deletion for alter_column() in the generic backend the same way the Oracle backend does it:


Now PostgreSQL passes the test too. I did not test with MySQL or SQLite.

comment:4 Changed 5 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed

All pulled.

Note: See TracTickets for help on using tickets.