From ac12d4cda37832be42a97cb4394dec158be2d86d Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 27 Feb 2022 19:03:21 -0800 Subject: [PATCH] Add migration to create Favorites table --- db/migrate/20220228014758_create_favorites.rb | 9 +++++++++ db/schema.rb | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20220228014758_create_favorites.rb diff --git a/db/migrate/20220228014758_create_favorites.rb b/db/migrate/20220228014758_create_favorites.rb new file mode 100644 index 0000000..c0a2d17 --- /dev/null +++ b/db/migrate/20220228014758_create_favorites.rb @@ -0,0 +1,9 @@ +class CreateFavorites < ActiveRecord::Migration[6.1] + def change + create_table :favorites, id: :uuid, default: -> { "gen_random_uuid()" } do |t| + t.references :user, type: :uuid + t.references :party, type: :uuid + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index e2f168e..69ed289 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: 2022_02_27_042147) do +ActiveRecord::Schema.define(version: 2022_02_28_014758) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -44,6 +44,15 @@ ActiveRecord::Schema.define(version: 2022_02_27_042147) do t.integer "max_atk_ulb" end + create_table "favorites", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.uuid "user_id" + t.uuid "party_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["party_id"], name: "index_favorites_on_party_id" + t.index ["user_id"], name: "index_favorites_on_user_id" + end + create_table "grid_characters", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "party_id" t.uuid "character_id"