Added support deleting UNIQUE partial indexes #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.