instance method
build_check_constraints
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
build_check_constraints(table_name, chk_info)
No documentation comment.
Parameters
-
table_namereq -
chk_inforeq
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