A platform for community discussion. Free, open, simple.
DEV: drop password-related columns from users table (#29187)
Kelv8f9b827d15cc
diff --git a/app/models/user.rb b/app/models/user.rbindex 00b9af0ed3a..07a4ca5b267 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -2,10 +2,9 @@class User < ActiveRecord::Baseself.ignored_columns = [- :old_seen_notification_id, # TODO: Remove when column is dropped. At this point, the migration to drop the column has not been written.- :salt, # TODO: Remove when column is dropped. At this point, the migration to drop the column has not been written.- :password_hash, # TODO: Remove when column is dropped. At this point, the migration to drop the column has not been written.- :password_algorithm, # TODO: Remove when column is dropped. At this point, the migration to drop the column has not been written.+ :salt, # TODO: Remove when DropPasswordColumnsFromUsers has been promoted to pre-deploy.+ :password_hash, # TODO: Remove when DropPasswordColumnsFromUsers has been promoted to pre-deploy.+ :password_algorithm, # TODO: Remove when DropPasswordColumnsFromUsers has been promoted to pre-deploy.:old_seen_notification_id, # TODO: Remove once 20240829140226_drop_old_notification_id_columns has been promoted to pre-deploy]diff --git a/db/post_migrate/20241011080517_drop_password_columns_from_users.rb b/db/post_migrate/20241011080517_drop_password_columns_from_users.rbnew file mode 100644index 00000000000..e43c98aad1d--- /dev/null+++ b/db/post_migrate/20241011080517_drop_password_columns_from_users.rb@@ -0,0 +1,12 @@+# frozen_string_literal: true+class DropPasswordColumnsFromUsers < ActiveRecord::Migration[7.1]+ DROPPED_COLUMNS ||= { users: %i[password_hash salt password_algorithm] }++ def up+ DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+end