17 lines
441 B
Ruby
17 lines
441 B
Ruby
class RemoveInvitationEmailFromUsers < ActiveRecord::Migration
|
|
def self.up
|
|
execute <<-SQL
|
|
UPDATE users
|
|
SET email = concat('invitemail_', id, '@example.org')
|
|
WHERE invitation_token IS NOT NULL
|
|
SQL
|
|
end
|
|
|
|
def self.down
|
|
execute <<-SQL
|
|
UPDATE users
|
|
SET email = (SELECT identifier FROM invitations WHERE invitations.recipient_id = users.id)
|
|
WHERE invitation_token IS NOT NULL
|
|
SQL
|
|
end
|
|
end
|