lib/strong_migrations/checker.rb in strong_migrations-0.7.5 vs lib/strong_migrations/checker.rb in strong_migrations-0.7.6
- old
+ new
@@ -217,11 +217,10 @@
table, column, null, default = args
if !null
if postgresql?
safe = false
if postgresql_version >= Gem::Version.new("12")
- # TODO likely need to quote the column in some situations
- safe = constraints(table).any? { |c| c["def"] == "CHECK ((#{column} IS NOT NULL))" }
+ safe = constraints(table).any? { |c| c["def"] == "CHECK ((#{column} IS NOT NULL))" || c["def"] == "CHECK ((#{connection.quote_column_name(column)} IS NOT NULL))" }
end
unless safe
# match https://github.com/nullobject/rein
constraint_name = "#{table}_#{column}_null"