-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration to rename old phone number labels (#234)
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class MigratePhoneNumberLabels < ActiveRecord::Migration[7.0] | ||
def up | ||
execute <<-SQL | ||
UPDATE phone_numbers SET label = 'Privat' WHERE label = 'Telefon Privat'; | ||
UPDATE phone_numbers SET label = 'Arbeit' WHERE label = 'Telefon Geschäft'; | ||
UPDATE phone_numbers SET label = 'Fax' WHERE label IN ('Fax Geschäft', 'Fax Privat'); | ||
UPDATE phone_numbers SET label = 'Andere' WHERE label = 'Import'; | ||
SQL | ||
end | ||
|
||
def down | ||
execute <<-SQL | ||
UPDATE phone_numbers SET label = 'Telefon Privat' WHERE label = 'Privat'; | ||
UPDATE phone_numbers SET label = 'Telefon Geschäft' WHERE label = 'Arbeit'; | ||
UPDATE phone_numbers SET label = 'Fax Privat' WHERE label = 'Fax' | ||
UPDATE phone_numbers SET label = 'Import' WHERE label = 'Andere'; | ||
SQL | ||
end | ||
end |