Skip to content

Commit

Permalink
Merge pull request #236 from hitobito/feature/234/migrate-phone-numbe…
Browse files Browse the repository at this point in the history
…r-labels

Add migration to rename old phone number labels (#234)
  • Loading branch information
kronn authored Feb 14, 2025
2 parents 782bd5f + dc4ea79 commit c9c2bca
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions db/migrate/20250129151501_migrate_phone_number_labels.rb
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

0 comments on commit c9c2bca

Please sign in to comment.