module AR::Check::SchemaDumper
Public Instance Methods
check_constraints(table, stream)
click to toggle source
# File lib/ar/check/schema_dumper.rb, line 11 def check_constraints(table, stream) constraints = @connection.check_constraints(table) return if constraints.empty? constraints.each do |constraint| expression = constraint["expression"] .gsub(/^\s*CHECK\s+\(/i, "") .gsub(/\)$/, "") statement = [ "add_check", ":#{constraint['table']},", ":#{constraint['name'].gsub("_on_#{table}", '')},", expression.inspect ].join(" ") stream.puts " #{statement}" end stream.puts end
table(table_name, stream)
click to toggle source
Calls superclass method
# File lib/ar/check/schema_dumper.rb, line 6 def table(table_name, stream) super check_constraints(table_name, stream) end