summaryrefslogtreecommitdiff
path: root/db/migrate/20210711195205_add_location_to_hearth.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20210711195205_add_location_to_hearth.rb')
-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