diff options
author | David Gay <david@davidgay.org> | 2021-05-22 15:39:16 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-22 15:39:16 -0400 |
commit | 38f3a39221869483e3468e9f4d8cab5450a70f89 (patch) | |
tree | ef831c35d61e05b46c356d39e30ecc6d6f7353b1 /db | |
parent | 88bd4f77db3a4372c118a9faef613615db66bc52 (diff) |
Equiping and unequiping items
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20210522184444_create_equipment.rb | 13 | ||||
-rw-r--r-- | db/schema.rb | 15 |
2 files changed, 26 insertions, 2 deletions
diff --git a/db/migrate/20210522184444_create_equipment.rb b/db/migrate/20210522184444_create_equipment.rb new file mode 100644 index 0000000..4ac9543 --- /dev/null +++ b/db/migrate/20210522184444_create_equipment.rb @@ -0,0 +1,13 @@ +class CreateEquipment < ActiveRecord::Migration[6.1] + def change + create_table :equipment do |t| + t.references :character, null: false, foreign_key: true + t.references :item, null: false, foreign_key: true + t.integer :slot + + t.timestamps + end + + remove_column :items, :equip_slot + end +end diff --git a/db/schema.rb b/db/schema.rb index f2d776a..5649a54 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_05_20_230859) do +ActiveRecord::Schema.define(version: 2021_05_22_184444) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -92,6 +92,16 @@ ActiveRecord::Schema.define(version: 2021_05_20_230859) do t.datetime "updated_at", precision: 6, null: false end + create_table "equipment", force: :cascade do |t| + t.bigint "character_id", null: false + t.bigint "item_id", null: false + t.integer "slot" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["character_id"], name: "index_equipment_on_character_id" + t.index ["item_id"], name: "index_equipment_on_item_id" + end + create_table "hearth_amenities", force: :cascade do |t| t.string "gid" t.string "name" @@ -113,7 +123,6 @@ ActiveRecord::Schema.define(version: 2021_05_20_230859) do t.string "gid" t.string "name" t.text "description" - t.integer "equip_slot" t.boolean "usable" t.jsonb "whatnot" t.datetime "created_at", precision: 6, null: false @@ -206,6 +215,8 @@ ActiveRecord::Schema.define(version: 2021_05_20_230859) do add_foreign_key "chat_messages", "characters", column: "sender_id" add_foreign_key "chat_messages", "characters", column: "target_id" add_foreign_key "chat_messages", "chat_rooms" + add_foreign_key "equipment", "characters" + add_foreign_key "equipment", "items" add_foreign_key "hearths", "characters" add_foreign_key "learned_activities", "activities" add_foreign_key "learned_activities", "characters" |