You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a unique constraint will automatically create a unique B-tree index on the column or group of columns listed in the constraint.
This suggests to me that it is just as unsafe as adding a unique index. However, when I use add_unique_constraint, I don't get a warning from strong_migrations like I would for an index.
One advantage of using add_unique_constraint is that it allows making the index deferred.
The text was updated successfully, but these errors were encountered:
Rails
add_unique_constraint
is documented at:https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/PostgreSQL/SchemaStatements.html#method-i-add_unique_constraint
According to the PostgreSQL documentation at:
https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS
This suggests to me that it is just as unsafe as adding a unique index. However, when I use
add_unique_constraint
, I don't get a warning from strong_migrations like I would for an index.One advantage of using
add_unique_constraint
is that it allows making the index deferred.The text was updated successfully, but these errors were encountered: