instance method check_constraint_exists?

Ruby on Rails 7.2.3

Since v7.1.6

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

Signature

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_name req
options keyrest
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

Type at least 2 characters to search.

↑↓ navigate · open · esc close