instance method check_constraint_exists?

Ruby on Rails 7.1.6

Since v7.1.6

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

check_constraint_exists?(*args, **options)

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?

Parameters

args rest
options keyrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 940
      def check_constraint_exists?(*args, **options)
        @base.check_constraint_exists?(name, *args, **options)
      end

Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 940 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::Table

Type at least 2 characters to search.

↑↓ navigate · open · esc close