Browse Source

Make the migration actually reversible

pull/41/head
baarkerlounger 3 years ago
parent
commit
bb4ef5e168
  1. 17
      db/migrate/20211011115946_rename_economic_status_fields.rb

17
db/migrate/20211011115946_rename_economic_status_fields.rb

@ -1,5 +1,5 @@
class RenameEconomicStatusFields < ActiveRecord::Migration[6.1] class RenameEconomicStatusFields < ActiveRecord::Migration[6.1]
def change def up
change_table :case_logs, bulk: true do |t| change_table :case_logs, bulk: true do |t|
t.rename :person_2_economic, :person_2_economic_status t.rename :person_2_economic, :person_2_economic_status
t.rename :person_3_economic, :person_3_economic_status t.rename :person_3_economic, :person_3_economic_status
@ -8,7 +8,20 @@ class RenameEconomicStatusFields < ActiveRecord::Migration[6.1]
t.rename :person_6_economic, :person_6_economic_status t.rename :person_6_economic, :person_6_economic_status
t.rename :person_7_economic, :person_7_economic_status t.rename :person_7_economic, :person_7_economic_status
t.rename :person_8_economic, :person_8_economic_status t.rename :person_8_economic, :person_8_economic_status
t.remove :postcode, :string
end end
remove_column :case_logs, :postcode
end
def down
change_table :case_logs, bulk: true do |t|
t.rename :person_2_economic_status, :person_2_economic
t.rename :person_3_economic_status, :person_3_economic
t.rename :person_4_economic_status, :person_4_economic
t.rename :person_5_economic_status, :person_5_economic
t.rename :person_6_economic_status, :person_6_economic
t.rename :person_7_economic_status, :person_7_economic
t.rename :person_8_economic_status, :person_8_economic
end
add_column :case_logs, :postcode, :string
end end
end end

Loading…
Cancel
Save