instance method
remove_check_constraint
Ruby on Rails 6.1.7.10
Since v6.1.7.10Signature
remove_check_constraint(table_name, expression = nil, **options)
Removes the given check constraint from the table.
remove_check_constraint :products, name: "price_check"
The expression parameter will be ignored if present. It can be helpful to provide this in a migration’s change method so it can be reverted. In that case, expression will be used by #add_check_constraint.
Parameters
-
table_namereq -
expressionopt = nil -
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 1175
def remove_check_constraint(table_name, expression = nil, **options)
return unless supports_check_constraints?
chk_name_to_delete = check_constraint_for!(table_name, expression: expression, **options).name
at = create_alter_table(table_name)
at.drop_check_constraint(chk_name_to_delete)
execute schema_creation.accept(at)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb line 1175
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::SchemaStatements