module Postgresql::Check::SchemaDumper
Public Instance Methods
table_with_checks(table, stream)
click to toggle source
# File lib/postgresql/check/schema_dumper.rb, line 11 def table_with_checks(table, stream) table_without_checks table, stream check_constraints table, stream end
Private Instance Methods
check_constraints(table, stream)
click to toggle source
# File lib/postgresql/check/schema_dumper.rb, line 17 def check_constraints(table, stream) if (checks = @connection.checks(table)).any? definitions = checks.map do |check| dump_check_constraint check end stream.puts definitions.join("\n") stream.puts "\n" end end
dump_check_constraint(check)
click to toggle source
# File lib/postgresql/check/schema_dumper.rb, line 28 def dump_check_constraint(check) <<-RUBY.chomp add_check "#{remove_prefix_and_suffix(check.table_name)}", "#{check.condition.gsub('"', '\"')}", name: "#{check.name}" RUBY end