summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20210503005919_create_character_items.rb11
-rw-r--r--db/schema.rb14
2 files changed, 24 insertions, 1 deletions
diff --git a/db/migrate/20210503005919_create_character_items.rb b/db/migrate/20210503005919_create_character_items.rb
new file mode 100644
index 0000000..50e926a
--- /dev/null
+++ b/db/migrate/20210503005919_create_character_items.rb
@@ -0,0 +1,11 @@
+class CreateCharacterItems < ActiveRecord::Migration[6.1]
+ def change
+ create_table :character_items do |t|
+ t.references :character, null: false, foreign_key: true
+ t.references :item, null: false, foreign_key: true
+ t.integer :quantity
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 9072ac3..a86c111 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_03_002720) do
+ActiveRecord::Schema.define(version: 2021_05_03_005919) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -24,6 +24,16 @@ ActiveRecord::Schema.define(version: 2021_05_03_002720) do
t.datetime "updated_at", precision: 6, null: false
end
+ create_table "character_items", force: :cascade do |t|
+ t.bigint "character_id", null: false
+ t.bigint "item_id", null: false
+ t.integer "quantity"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["character_id"], name: "index_character_items_on_character_id"
+ t.index ["item_id"], name: "index_character_items_on_item_id"
+ end
+
create_table "characters", force: :cascade do |t|
t.string "name"
t.bigint "user_id", null: false
@@ -83,6 +93,8 @@ ActiveRecord::Schema.define(version: 2021_05_03_002720) do
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
end
+ add_foreign_key "character_items", "characters"
+ add_foreign_key "character_items", "items"
add_foreign_key "characters", "activities"
add_foreign_key "characters", "users"
add_foreign_key "users", "characters", column: "active_character_id"