Skip to content

A platform for community discussion. Free, open, simple.

FIX: Drop unused tables with a delay

Gerhard Schlager43f63c435d00
diff --git a/db/fixtures/999_delayed.rb b/db/fixtures/999_delayed.rb
index 6a7ea17e803..7b6d280db97 100644
--- a/db/fixtures/999_delayed.rb
+++ b/db/fixtures/999_delayed.rb
@@ -10,3 +10,19 @@ Migration::TableDropper.delayed_rename(
STDERR.puts "Dropping topic_status_updates. It was moved to topic_timers."
}
)
+
+Migration::TableDropper.delayed_drop(
+ table_name: 'category_featured_users',
+ after_migration: 'DropUnusedTables',
+ on_drop: ->() {
+ STDERR.puts "Dropping category_featured_users. It isn't used anymore."
+ }
+)
+
+Migration::TableDropper.delayed_drop(
+ table_name: 'versions',
+ after_migration: 'DropUnusedTables',
+ on_drop: ->() {
+ STDERR.puts "Dropping versions. It isn't used anymore."
+ }
+)
diff --git a/db/migrate/20180227161818_drop_unused_tables.rb b/db/migrate/20180227161818_drop_unused_tables.rb
index 1db8c57d551..f0c735f0218 100644
--- a/db/migrate/20180227161818_drop_unused_tables.rb
+++ b/db/migrate/20180227161818_drop_unused_tables.rb
@@ -1,7 +1,6 @@
class DropUnusedTables < ActiveRecord::Migration[5.1]
def up
- drop_table :category_featured_users
- drop_table :versions
+ # Delayed drop of tables "category_featured_users" and "versions"
end
def down