activerecord-cockroachdb-adapter
activerecord-cockroachdb-adapter copied to clipboard
fix: Avoid dumping unique_constraint when attisdropped
Fixes #347
Columns with the UNIQUE constraint automatically have an index created with the name
<table name>_<columns>_key. To avoid having two identical indexes, you should not create indexes that exactly match the UNIQUE constraint's columns and order.
(https://www.cockroachlabs.com/docs/stable/unique)
I think we can just consider every unique_constraint as an index then.
The UNIQUE constraint depends on the automatically created index, so dropping the index also drops the UNIQUE constraint. Conversely, dropping the UNIQUE constraint also drops the automatically created index.