Remove email column from user table

This commit is contained in:
Sam
2017-08-29 11:50:56 -04:00
parent b3fd091379
commit c705159d22
4 changed files with 24 additions and 7 deletions

View File

@ -30,13 +30,13 @@ class ColumnDropper
on_drop&.call
columns.each do |column|
ActiveRecord::Base.exec_sql <<~SQL
DROP TRIGGER IF EXISTS #{readonly_trigger_name(table, column)} ON #{table};
DROP FUNCTION IF EXISTS #{readonly_function_name(table, column)};
SQL
# safe cause it is protected on method entry, can not be passed in params
ActiveRecord::Base.exec_sql("ALTER TABLE #{table} DROP COLUMN IF EXISTS #{column}")
ActiveRecord::Base.exec_sql <<~SQL
DROP FUNCTION IF EXISTS #{readonly_function_name(table, column)};
DROP TRIGGER IF EXISTS #{readonly_trigger_name(table, column)} ON #{table};
SQL
end
Discourse.reset_active_record_cache