summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-07-11 15:55:19 -0400
committerDavid Gay <david@davidgay.org>2021-07-11 15:55:19 -0400
commit362b92dbebf1ccc529794890153f8c1bfc43637d (patch)
tree532f6901b2e8dfd335262d2ae81ca248af402539 /db/migrate
parent1d0f65a3c143c729aea0a22fe4666a8a0cff23c9 (diff)
Give hearths a location
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20210711195205_add_location_to_hearth.rb9
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