instance method
unique_constraint_exists?
Ruby on Rails edge
Since edgeSignature
unique_constraint_exists?(*args, **options)
Checks if a unique constraint exists on a table.
unless t.unique_constraint_exists?(name: "unique_position")
t.unique_constraint(:position, name: "unique_position", deferrable: :deferred)
end
See connection.unique_constraint_exists?
Parameters
-
argsrest -
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 376
def unique_constraint_exists?(*args, **options)
@base.unique_constraint_exists?(name, *args, **options)
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb line 376
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQL::Table