0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-05 21:57:36 +08:00
discourse/db/migrate/20241112145744_anonymize_normalized_email_column.rb

14 lines
329 B
Ruby
Vendored

# 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