From 362b92dbebf1ccc529794890153f8c1bfc43637d Mon Sep 17 00:00:00 2001 From: David Gay Date: Sun, 11 Jul 2021 15:55:19 -0400 Subject: Give hearths a location --- db/migrate/20210711195205_add_location_to_hearth.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20210711195205_add_location_to_hearth.rb (limited to 'db/migrate') diff --git a/db/migrate/20210711195205_add_location_to_hearth.rb b/db/migrate/20210711195205_add_location_to_hearth.rb new file mode 100644 index 0000000..c8031d6 --- /dev/null +++ b/db/migrate/20210711195205_add_location_to_hearth.rb @@ -0,0 +1,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 -- cgit v1.2.3