diff --git a/db/fixtures/001_categories.rb b/db/fixtures/001_categories.rb index 67c1c88a904..1a0282b84e9 100644 --- a/db/fixtures/001_categories.rb +++ b/db/fixtures/001_categories.rb @@ -30,7 +30,7 @@ ColumnDropper.drop( table: 'categories', after_migration: 'AddUploadsToCategories', columns: ['logo_url', 'background_url'], - on_remove: ->(){ + on_drop: ->(){ STDERR.puts 'Removing superflous categories columns!' } ) diff --git a/db/fixtures/009_users.rb b/db/fixtures/009_users.rb index 799a05d23fb..d725d78a414 100644 --- a/db/fixtures/009_users.rb +++ b/db/fixtures/009_users.rb @@ -49,7 +49,7 @@ ColumnDropper.drop( last_redirected_to_top_at auth_token auth_token_updated_at ], - on_remove: ->(){ + on_drop: ->(){ STDERR.puts 'Removing superflous users columns!' } ) diff --git a/db/fixtures/600_themes.rb b/db/fixtures/600_themes.rb index 26ab6216f8c..0ec6e274d28 100644 --- a/db/fixtures/600_themes.rb +++ b/db/fixtures/600_themes.rb @@ -22,7 +22,7 @@ ColumnDropper.drop( table: 'theme_fields', after_migration: 'AddUploadIdToThemeFields', columns: ['target'], - on_remove: ->(){ + on_drop: ->(){ STDERR.puts 'Removing superflous theme_fields target column!' } ) diff --git a/db/fixtures/999_topics.rb b/db/fixtures/999_topics.rb index 2fed96dae6b..9587290a228 100644 --- a/db/fixtures/999_topics.rb +++ b/db/fixtures/999_topics.rb @@ -78,7 +78,7 @@ ColumnDropper.drop( illegal_count notify_user_count }, - on_remove: ->(){ + on_drop: ->(){ STDERR.puts "Removing superflous topic columns!" } ) diff --git a/lib/column_dropper.rb b/lib/column_dropper.rb index a30adbb7b83..766ddddddfb 100644 --- a/lib/column_dropper.rb +++ b/lib/column_dropper.rb @@ -1,5 +1,5 @@ class ColumnDropper - def self.drop(table:, after_migration:, columns:, delay: nil, on_remove: nil) + def self.drop(table:, after_migration:, columns:, delay: nil, on_drop: nil) raise ArgumentError.new("Invalid table name passed to drop #{table}") if table =~ /[^a-z0-9_]/i columns.each do |column| @@ -27,7 +27,7 @@ SQL columns: columns, delay: "#{delay.to_i || 0} seconds", after_migration: after_migration).to_a.length > 0 - on_remove&.call + on_drop&.call columns.each do |column| # safe cause it is protected on method entry, can not be passed in params diff --git a/spec/components/column_dropper_spec.rb b/spec/components/column_dropper_spec.rb index 02d6a3d56dd..c1274ae6063 100644 --- a/spec/components/column_dropper_spec.rb +++ b/spec/components/column_dropper_spec.rb @@ -30,7 +30,7 @@ describe ColumnDropper do after_migration: name, columns: ['junk'], delay: 20.minutes, - on_remove: ->(){dropped_proc_called = true} + on_drop: ->(){dropped_proc_called = true} ) expect(has_column?('topics', 'junk')).to eq(true) @@ -41,7 +41,7 @@ describe ColumnDropper do after_migration: name, columns: ['junk'], delay: 10.minutes, - on_remove: ->(){dropped_proc_called = true} + on_drop: ->(){dropped_proc_called = true} ) expect(has_column?('topics', 'junk')).to eq(false)