instance method
check_constraint_exists?
Ruby on Rails 7.2.3
Since v7.1.6Signature
check_constraint_exists?(table_name, **options)
Checks to see if a check constraint exists on a table for a given check constraint definition.
check_constraint_exists?(:products, name: "price_check")
Parameters
-
table_namereq -
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 1324
def check_constraint_exists?(table_name, **options)
if !options.key?(:name) && !options.key?(:expression)
raise ArgumentError, "At least one of :name or :expression must be supplied"
end
check_constraint_for(table_name, **options).present?
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb line 1324
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::SchemaStatements