diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20210711195205_add_location_to_hearth.rb | 9 | ||||
-rw-r--r-- | db/schema.rb | 5 |
2 files changed, 13 insertions, 1 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 diff --git a/db/schema.rb b/db/schema.rb index 3c6cc28..2263181 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_07_06_000053) do +ActiveRecord::Schema.define(version: 2021_07_11_195205) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -155,7 +155,9 @@ ActiveRecord::Schema.define(version: 2021_07_06_000053) do t.bigint "character_id", null: false t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.bigint "location_id", null: false t.index ["character_id"], name: "index_hearths_on_character_id" + t.index ["location_id"], name: "index_hearths_on_location_id" end create_table "item_infixes", force: :cascade do |t| @@ -332,6 +334,7 @@ ActiveRecord::Schema.define(version: 2021_07_06_000053) do add_foreign_key "hearth_plantings", "hearths" add_foreign_key "hearth_plantings", "items" add_foreign_key "hearths", "characters" + add_foreign_key "hearths", "locations" add_foreign_key "item_infixes", "characters" add_foreign_key "item_infixes", "items" add_foreign_key "item_infixes", "skills" |