impress/db/migrate/20240123133215_add_label_and_plain_label_to_zones.rb
Emi Matchu 73af9d4d77 Start migrating off globalize gem for zones
Like in 0dca538, this is preliminary work for being able to drop the
`zone_translations` table! We're copying the field over first, to be
able to migrate DTI 2020 safely before dropping anything.
2024-01-23 05:43:00 -08:00

16 lines
482 B
Ruby

class AddLabelAndPlainLabelToZones < ActiveRecord::Migration[7.1]
def change
add_column :zones, :label, :string, null: false
add_column :zones, :plain_label, :string, null: false
reversible do |direction|
direction.up do
Zone.includes(:translations).find_each do |zone|
zone.label = zone.translation_for(:en).label
zone.plain_label = zone.translation_for(:en).plain_label
zone.save!
end
end
end
end
end