method

check_constraint_exists?

rails latest stable - Class: ActiveRecord::ConnectionAdapters::Table

Method not available on this version

This method is only available on newer versions. The first available version (v8.1.1) is shown here.

check_constraint_exists?(*args, **options)
public

Checks if a check_constraint exists on a table.

unless t.check_constraint_exists?(name: "price_check")
  t.check_constraint("price > 0", name: "price_check")
end

See {connection.check_constraint_exists?}[rdoc-ref:SchemaStatements#check_constraint_exists?]