summaryrefslogtreecommitdiff
path: root/db/migrate/20210711195205_add_location_to_hearth.rb
blob: c8031d698ddb24e0fb819f1dc9edd5aada16decf (plain)
1
2
3
4
5
6
7
8
9
class AddLocationToHearth < ActiveRecord::Migration[6.1]
  def change
    add_reference :hearths, :location, foreign_key: true
    Hearth.all.each do |hearth|
      hearth.update(location: Location.find_by_gid("floret"))
    end
    change_column :hearths, :location_id, :bigint, null: false
  end
end