Keep second semantics for method

This commit is contained in:
Sam 2018-02-28 09:21:38 +11:00
parent b832c3d885
commit 182aaffbd5
1 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,8 @@ class ColumnDropper
raise ArgumentError.new("Invalid column name passed to drop #{column}") if column =~ /[^a-z0-9_]/i raise ArgumentError.new("Invalid column name passed to drop #{column}") if column =~ /[^a-z0-9_]/i
end end
delay ||= Rails.env.production? ? 60 : 0 # in production we need some extra delay to allow for slow migrations
delay ||= Rails.env.production? ? 360 : 0
sql = <<~SQL sql = <<~SQL
SELECT 1 SELECT 1
@ -25,7 +26,7 @@ class ColumnDropper
if ActiveRecord::Base.exec_sql(sql, table: table, if ActiveRecord::Base.exec_sql(sql, table: table,
columns: columns, columns: columns,
delay: "#{delay.to_i || 0} minutes", delay: "#{delay.to_i || 0} seconds",
after_migration: after_migration).to_a.length > 0 after_migration: after_migration).to_a.length > 0
on_drop&.call on_drop&.call