diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20210705235925_update_floret_gid.rb | 5 | ||||
-rw-r--r-- | db/migrate/20210706000053_add_location_to_character.rb | 9 | ||||
-rw-r--r-- | db/schema.rb | 5 |
3 files changed, 18 insertions, 1 deletions
diff --git a/db/migrate/20210705235925_update_floret_gid.rb b/db/migrate/20210705235925_update_floret_gid.rb new file mode 100644 index 0000000..db24044 --- /dev/null +++ b/db/migrate/20210705235925_update_floret_gid.rb @@ -0,0 +1,5 @@ +class UpdateFloretGid < ActiveRecord::Migration[6.1] + def change + Location.find_by_gid("floret_region").update(gid: "floret") + end +end diff --git a/db/migrate/20210706000053_add_location_to_character.rb b/db/migrate/20210706000053_add_location_to_character.rb new file mode 100644 index 0000000..ec71ee8 --- /dev/null +++ b/db/migrate/20210706000053_add_location_to_character.rb @@ -0,0 +1,9 @@ +class AddLocationToCharacter < ActiveRecord::Migration[6.1] + def change + add_reference :characters, :location, foreign_key: true + Character.all.each do |character| + character.update(location_id: Location.find_by_gid("floret").id) + end + change_column :characters, :location_id, :bigint, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 6c503fd..3c6cc28 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_06_16_014044) do +ActiveRecord::Schema.define(version: 2021_07_06_000053) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -86,8 +86,10 @@ ActiveRecord::Schema.define(version: 2021_06_16_014044) do t.integer "defensive_style" t.integer "rested_duration" t.datetime "started_resting_at" + t.bigint "location_id", null: false t.index ["active_title_id"], name: "index_characters_on_active_title_id" t.index ["activity_id"], name: "index_characters_on_activity_id" + t.index ["location_id"], name: "index_characters_on_location_id" t.index ["user_id"], name: "index_characters_on_user_id" end @@ -319,6 +321,7 @@ ActiveRecord::Schema.define(version: 2021_06_16_014044) do add_foreign_key "character_skills", "characters" add_foreign_key "character_skills", "skills" add_foreign_key "characters", "activities" + add_foreign_key "characters", "locations" add_foreign_key "characters", "titles", column: "active_title_id" add_foreign_key "characters", "users" add_foreign_key "chat_messages", "characters", column: "sender_id" |