Drop reply_key, skipped and skipped_reason from email_logs.

This commit is contained in:
Guo Xiang Tan
2018-07-27 12:32:07 +08:00
parent b94633e844
commit 87537b679c
10 changed files with 65 additions and 62 deletions

View File

@ -241,9 +241,12 @@ Migration::ColumnDropper.drop(
Migration::ColumnDropper.drop(
table: 'email_logs',
after_migration: 'DropTopicIdOnEmailLogs',
after_migration: 'DropReplyKeySkippedSkippedReasonFromEmailLogs',
columns: %w{
topic_id
reply_key
skipped
skipped_reason
},
on_drop: ->() {
STDERR.puts "Removing superflous email_logs columns!"

View File

@ -0,0 +1,11 @@
class DropReplyKeySkippedSkippedReasonFromEmailLogs < ActiveRecord::Migration[5.2]
def up
remove_index :email_logs, [:skipped, :bounced, :created_at]
remove_index :email_logs, name: 'idx_email_logs_user_created_filtered'
add_index :email_logs, [:user_id, :created_at]
end
def down
raise ActiveRecord::IrreversibleMigration
end
end