6 changed files with 80 additions and 76 deletions
@ -1,33 +1,58 @@
|
||||
class FurtherCoreMigrations < ActiveRecord::Migration[6.1] |
||||
def up |
||||
remove_column :case_logs, :condition_effects_prefer_not_to_say |
||||
rename_column :case_logs, :reason_for_leaving_last_settled_home, :reason |
||||
rename_column :case_logs, :property_reference, :propcode |
||||
rename_column :case_logs, :property_major_repairs, :majorrepairs |
||||
rename_column :case_logs, :property_location, :la |
||||
rename_column :case_logs, :previous_la, :prevloc |
||||
rename_column :case_logs, :housing_benefit, :hb |
||||
rename_column :case_logs, :outstanding_rent_or_charges, :hbrentshortfall |
||||
rename_column :case_logs, :outstanding_amount, :tshortfall |
||||
add_column :case_logs, :postcode, :string |
||||
add_column :case_logs, :postcod2, :string |
||||
add_column :case_logs, :ppostc1, :string |
||||
add_column :case_logs, :ppostc2, :string |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.remove :condition_effects_prefer_not_to_say |
||||
t.remove :reason_for_leaving_last_settled_home |
||||
t.column :reason, :integer |
||||
t.remove :property_reference |
||||
t.column :propcode, :string |
||||
t.remove :property_major_repairs |
||||
t.column :majorrepairs, :integer |
||||
t.remove :property_location |
||||
t.column :la, :string |
||||
t.remove :previous_la |
||||
t.column :prevloc, :string |
||||
t.remove :housing_benefit |
||||
t.column :hb, :integer |
||||
t.remove :outstanding_rent_or_charges |
||||
t.column :hbrentshortfall, :integer |
||||
t.remove :outstanding_amount |
||||
t.column :tshortfall, :integer |
||||
t.column :postcode, :string |
||||
t.column :postcod2, :string |
||||
t.column :ppostc1, :string |
||||
t.column :ppostc2, :string |
||||
t.remove :property_relet |
||||
t.column :property_relet, :integer |
||||
end |
||||
end |
||||
|
||||
def down |
||||
add_column :case_logs, :condition_effects_prefer_not_to_say, :integer |
||||
rename_column :case_logs, :reason, :reason_for_leaving_last_settled_home |
||||
rename_column :case_logs, :propcode, :property_reference |
||||
rename_column :case_logs, :majorrepairs, :property_major_repairs |
||||
rename_column :case_logs, :la, :property_location |
||||
rename_column :case_logs, :prevloc, :previous_la |
||||
rename_column :case_logs, :hb, :housing_benefit |
||||
rename_column :case_logs, :hbrentshortfall, :outstanding_rent_or_charges |
||||
rename_column :case_logs, :tshortfall, :outstanding_amount |
||||
remove_column :case_logs, :postcode |
||||
remove_column :case_logs, :postcod2 |
||||
remove_column :case_logs, :ppostc1 |
||||
remove_column :case_logs, :ppostc2 |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.column :condition_effects_prefer_not_to_say, :integer |
||||
t.column :condition_effects_prefer_not_to_say, :integer |
||||
t.column :reason_for_leaving_last_settled_home, :string |
||||
t.remove :reason |
||||
t.column :property_reference, :string |
||||
t.remove :propcode |
||||
t.column :property_major_repairs, :string |
||||
t.remove :majorrepairs |
||||
t.column :property_location, :string |
||||
t.remove :la |
||||
t.column :previous_la, :string |
||||
t.remove :prevloc |
||||
t.column :housing_benefit, :string |
||||
t.remove :hb |
||||
t.column :outstanding_rent_or_charges, :string |
||||
t.remove :hbrentshortfall |
||||
t.column :outstanding_amount, :string |
||||
t.remove :tshortfall |
||||
t.remove :postcode |
||||
t.remove :postcod2 |
||||
t.remove :ppostc1 |
||||
t.remove :ppostc2 |
||||
t.remove :property_relet |
||||
t.column :property_relet, :string |
||||
end |
||||
end |
||||
end |
||||
|
@ -1,21 +0,0 @@
|
||||
class FurtherChangeFieldTypes < ActiveRecord::Migration[6.1] |
||||
def up |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.change :reason, "integer USING reason::integer" |
||||
t.change :majorrepairs, "integer USING majorrepairs::integer" |
||||
t.change :hb, "integer USING hb::integer" |
||||
t.change :hbrentshortfall, "integer USING hbrentshortfall::integer" |
||||
t.change :tshortfall, "integer USING tshortfall::integer" |
||||
end |
||||
end |
||||
|
||||
def down |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.change :reason, :string |
||||
t.change :majorrepairs, :string |
||||
t.change :hb, :string |
||||
t.change :hbrentshortfall, :string |
||||
t.change :tshortfall, :string |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue