From 1c05ca91ea78b42be26d7b97f6ea2efcd2d61314 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 5 Jun 2017 10:59:05 +0900 Subject: [PATCH] Remove columns that are no longer being used. --- db/fixtures/999_topics.rb | 15 +++++++++++++++ ...14820_remove_auto_close_columns_from_topics.rb | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 db/migrate/20170605014820_remove_auto_close_columns_from_topics.rb diff --git a/db/fixtures/999_topics.rb b/db/fixtures/999_topics.rb index abdc372e8a..6abc06a14c 100644 --- a/db/fixtures/999_topics.rb +++ b/db/fixtures/999_topics.rb @@ -95,3 +95,18 @@ ColumnDropper.drop( STDERR.puts "Removing superflous topic columns!" } ) + +ColumnDropper.drop( + table: 'topics', + after_migration: 'RemoveAutoCloseColumnsFromTopics', + columns: %w{ + auto_close_at + auto_close_user_id + auto_close_started_at + auto_close_based_on_last_post + auto_close_hours + }, + on_drop: ->(){ + STDERR.puts "Removing superflous topic columns!" + } +) diff --git a/db/migrate/20170605014820_remove_auto_close_columns_from_topics.rb b/db/migrate/20170605014820_remove_auto_close_columns_from_topics.rb new file mode 100644 index 0000000000..4e6c2b6700 --- /dev/null +++ b/db/migrate/20170605014820_remove_auto_close_columns_from_topics.rb @@ -0,0 +1,9 @@ +class RemoveAutoCloseColumnsFromTopics < ActiveRecord::Migration + def up + # Defer dropping of the columns until the new application code has been deployed. + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end