DEV: drop password-related columns from users table (#29187)

This commit is contained in:
Kelv 2024-10-23 13:42:35 +08:00 committed by GitHub
parent cd077ef93b
commit 8f9b827d15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 4 deletions

View File

@ -2,10 +2,9 @@
class User < ActiveRecord::Base
self.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
]

View File

@ -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