diff options
author | David Gay <david@davidgay.org> | 2021-07-11 15:55:19 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-07-11 15:55:19 -0400 |
commit | 362b92dbebf1ccc529794890153f8c1bfc43637d (patch) | |
tree | 532f6901b2e8dfd335262d2ae81ca248af402539 /db/migrate | |
parent | 1d0f65a3c143c729aea0a22fe4666a8a0cff23c9 (diff) |
Give hearths a location
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20210711195205_add_location_to_hearth.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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 |