Sha256: 4c37065b72a1a4f86b48be6e346a309dc855af2ed7ca35971f3048ac42efc8fc
Contents?: true
Size: 1.22 KB
Versions: 84
Compression:
Stored size: 1.22 KB
Contents
class AddUKRDCModalityCodeIdToModalityDescriptions < ActiveRecord::Migration[5.2] def change # add_column :modality_descriptions, :ukrdc_modality_code_id, :integer add_reference :modality_descriptions, :ukrdc_modality_code, foreign_key: true reversible do |direction| direction.up do # Obviously this 'data migration' will only apply if modality_descriptions are already seeded! connection.execute(<<-SQL.squish) update renalware.modality_descriptions set ukrdc_modality_code_id = (select id from renalware.ukrdc_modality_codes where qbl_code = '19') where name = 'PD'; update renalware.modality_descriptions set ukrdc_modality_code_id = (select id from renalware.ukrdc_modality_codes where qbl_code = '1') where name = 'HD'; update renalware.modality_descriptions set ukrdc_modality_code_id = (select id from renalware.ukrdc_modality_codes where qbl_code = '29') where name = 'Transplant'; update renalware.modality_descriptions set ukrdc_modality_code_id = (select id from renalware.ukrdc_modality_codes where qbl_code = '900') where name = 'vCKD'; SQL end direction.down do # noop end end end end
Version data entries
84 entries across 84 versions & 1 rubygems