-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support deleting UNIQUE partial indexes (#22)
Added support for deleting unique indexes with WHERE conditions. By default, if the created unique index contains no conditions, PostgresSQL automatically creates a Constraint for it, for example: CREATE UNIQUE INDEX CONCURRENTLY examples_new_col_idx ON examples (new_col); ALTER TABLE examples ADD CONSTRAINT examples_unique_constraint USING INDEX examples_new_col_idx; If the unique index contains WHERE conditions, then such a Constraint will not be created, because PostgreSQL doesn't define a partial (ie conditional) UNIQUE constraint. When trying to delete such a partial unique index, we get the error "Unique Constraint not found", so the standard command to remove $table->dropUnique() does not fit, the command $table->dropIndex() is suitable, but if pass the array there, then the index name will be generated as for a regular index with the suffix _index, instead of _unique, which we need. And manually generating the index name is wrong. This Merge Request solves these problems.
- Loading branch information
Showing
5 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters