Add tables for Siero

This commit is contained in:
Justin Edmund 2023-05-04 12:54:10 -07:00
parent 488c34388d
commit 0b3b777021
9 changed files with 99 additions and 1 deletions

View file

@ -0,0 +1,13 @@
class AddGachaTable < ActiveRecord::Migration[7.0]
create_table :gacha, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.references :drawable, polymorphic: true
t.boolean :premium
t.boolean :classic
t.boolean :flash
t.boolean :legend
t.boolean :valentines
t.boolean :summer
t.boolean :halloween
t.boolean :holiday
end
end

View file

@ -0,0 +1,5 @@
class AddRecruitsToWeapon < ActiveRecord::Migration[7.0]
def change
add_reference :weapons, :recruits, null: true, to_table: 'character_id', type: :uuid
end
end

View file

@ -0,0 +1,7 @@
class ChangeGachaDrawableIdToUuid < ActiveRecord::Migration[7.0]
def change
remove_column :gacha, :drawable_id, :bigint
remove_column :gacha, :drawable_type, :string
add_reference :gacha, :drawable, polymorphic: true, type: :uuid
end
end

View file

@ -0,0 +1,5 @@
class MakeGachaDrawableIdUnique < ActiveRecord::Migration[7.0]
def change
add_index :gacha, :drawable_id, unique: true
end
end

View file

@ -0,0 +1,8 @@
class AddGachaRateupsTable < ActiveRecord::Migration[7.0]
create_table :gacha_rateups, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.references :gacha, type: :uuid
t.string :user_id
t.numeric :rate
t.datetime :created_at, null: false, default: -> { 'CURRENT_TIMESTAMP' }
end
end

View file

@ -0,0 +1,11 @@
class AddSparksTable < ActiveRecord::Migration[7.0]
create_table :sparks, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :user_id, null: false
t.string :guild_ids, array: true, null: false
t.integer :crystals, default: 0
t.integer :tickets, default: 0
t.integer :ten_tickets, default: 0
t.references :target, polymorphic: true
t.datetime :updated_at, null: false, default: -> { 'CURRENT_TIMESTAMP' }
end
end

View file

@ -0,0 +1,5 @@
class AddTargetMemoToSparks < ActiveRecord::Migration[7.0]
def change
add_column :sparks, :target_memo, :string
end
end

View file

@ -0,0 +1,5 @@
class MakeUserIdUniqueInSparks < ActiveRecord::Migration[7.0]
def change
add_index :sparks, :user_id, unique: true
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_04_19_102354) do
ActiveRecord::Schema[7.0].define(version: 2023_05_03_224353) do
# These are extensions that must be enabled in order to support this database
enable_extension "btree_gin"
enable_extension "pg_trgm"
@ -124,6 +124,29 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_19_102354) do
t.index ["user_id"], name: "index_favorites_on_user_id"
end
create_table "gacha", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.boolean "premium"
t.boolean "classic"
t.boolean "flash"
t.boolean "legend"
t.boolean "valentines"
t.boolean "summer"
t.boolean "halloween"
t.boolean "holiday"
t.string "drawable_type"
t.uuid "drawable_id"
t.index ["drawable_id"], name: "index_gacha_on_drawable_id", unique: true
t.index ["drawable_type", "drawable_id"], name: "index_gacha_on_drawable"
end
create_table "gacha_rateups", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "gacha_id"
t.string "user_id"
t.decimal "rate"
t.datetime "created_at", default: -> { "CURRENT_TIMESTAMP" }, null: false
t.index ["gacha_id"], name: "index_gacha_rateups_on_gacha_id"
end
create_table "grid_characters", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "party_id"
t.uuid "character_id"
@ -331,6 +354,20 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_19_102354) do
t.string "slug"
end
create_table "sparks", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "user_id", null: false
t.string "guild_ids", null: false, array: true
t.integer "crystals", default: 0
t.integer "tickets", default: 0
t.integer "ten_tickets", default: 0
t.string "target_type"
t.bigint "target_id"
t.datetime "updated_at", default: -> { "CURRENT_TIMESTAMP" }, null: false
t.string "target_memo"
t.index ["target_type", "target_id"], name: "index_sparks_on_target"
t.index ["user_id"], name: "index_sparks_on_user_id", unique: true
end
create_table "summons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "name_en"
t.string "name_jp"
@ -413,7 +450,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_19_102354) do
t.integer "awakening_types", default: [], array: true
t.string "nicknames_en", default: [], null: false, array: true
t.string "nicknames_jp", default: [], null: false, array: true
t.uuid "recruits_id"
t.index ["name_en"], name: "index_weapons_on_name_en", opclass: :gin_trgm_ops, using: :gin
t.index ["recruits_id"], name: "index_weapons_on_recruits_id"
end
add_foreign_key "favorites", "parties"