1. Sean Davis
  2. mysql2postgres

Commits

Sean Davis  committed 480c01f

Added column name quoting in check constraint

  • Participants
  • Parent commits 3c18117
  • Branches master

Comments (0)

Files changed (1)

File lib/mysql2psql/postgres_writer.rb

View file
         default = default + "::character varying" if default
         enum = column[:type].gsub(/enum|\(|\)/, '')
         max_enum_size = enum.split(',').map{ |check| check.size() -2}.sort[-1]
-        "character varying(#{max_enum_size}) check( #{column[:name]} in (#{enum}))"
+        "character varying(#{max_enum_size}) check( \"#{column[:name]}\" in (#{enum}))"
       else
         puts "Unknown #{column.inspect}"
         column[:type].inspect