mirror of
https://github.com/discourse/discourse.git
synced 2024-12-21 14:24:27 +08:00
15 lines
329 B
Ruby
15 lines
329 B
Ruby
# frozen_string_literal: true
|
|
class AnonymizeNormalizedEmailColumn < ActiveRecord::Migration[7.1]
|
|
def up
|
|
execute <<~SQL
|
|
UPDATE user_emails
|
|
SET normalized_email = email
|
|
WHERE SPLIT_PART(email, '@', 2) = 'anonymized.invalid'
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|