instance method build_check_constraints

Ruby on Rails edge

Since edge Private — implementation detail, not part of the public API

Signature

build_check_constraints(table_name, chk_info)

No documentation comment.

Parameters

table_name req
chk_info req
Source
# File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 859
        def build_check_constraints(table_name, chk_info)
          chk_info.map do |row|
            options = { name: row["name"] }
            expression = row["expression"]
            expression = expression[1..-2] if expression.start_with?("(") && expression.end_with?(")")
            expression = strip_whitespace_characters(expression)

            unless mariadb?
              # MySQL returns check constraints expression in an already escaped form.
              # This leads to duplicate escaping later (e.g. when the expression is used in the SchemaDumper).
              expression = expression.gsub("\\'", "'")
            end

            CheckConstraintDefinition.new(table_name, expression, options)
          end
        end

Defined in activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb line 859 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close