From 6f646101f25e7cc84f22123898189cea1f86100c Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 2 Dec 2025 04:39:15 -0800 Subject: [PATCH] add promotions integer array to weapons and summons --- app/models/concerns/granblue_enums.rb | 14 ++ ...6_add_promotions_to_weapons_and_summons.rb | 9 + db/schema.rb | 180 +----------------- 3 files changed, 28 insertions(+), 175 deletions(-) create mode 100644 db/migrate/20251202123526_add_promotions_to_weapons_and_summons.rb diff --git a/app/models/concerns/granblue_enums.rb b/app/models/concerns/granblue_enums.rb index ed9bc79..17985fd 100644 --- a/app/models/concerns/granblue_enums.rb +++ b/app/models/concerns/granblue_enums.rb @@ -60,4 +60,18 @@ module GranblueEnums Formal: 14, Event: 15 }.freeze + + # Gacha promotions - which pools/banners a weapon or summon appears in + PROMOTIONS = { + Premium: 1, + Classic: 2, + ClassicII: 3, + Flash: 4, + Legend: 5, + Valentine: 6, + Summer: 7, + Halloween: 8, + Holiday: 9, + Collab: 10 + }.freeze end diff --git a/db/migrate/20251202123526_add_promotions_to_weapons_and_summons.rb b/db/migrate/20251202123526_add_promotions_to_weapons_and_summons.rb new file mode 100644 index 0000000..c08e039 --- /dev/null +++ b/db/migrate/20251202123526_add_promotions_to_weapons_and_summons.rb @@ -0,0 +1,9 @@ +class AddPromotionsToWeaponsAndSummons < ActiveRecord::Migration[8.0] + def change + add_column :weapons, :promotions, :integer, array: true, default: [], null: false + add_column :summons, :promotions, :integer, array: true, default: [], null: false + + add_index :weapons, :promotions, using: :gin + add_index :summons, :promotions, using: :gin + end +end diff --git a/db/schema.rb b/db/schema.rb index ec4ee2f..48bae20 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,182 +10,13 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_12_02_120531) do +ActiveRecord::Schema[8.0].define(version: 2025_12_02_123526) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" - enable_extension "citext" enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" enable_extension "pg_trgm" enable_extension "pgcrypto" - enable_extension "uuid-ossp" - - create_table "Album", id: :serial, force: :cascade do |t| - t.string "slug", limit: 255, null: false - t.string "title", limit: 255, null: false - t.text "description" - t.datetime "date", precision: 3 - t.string "location", limit: 255 - t.integer "coverPhotoId" - t.string "status", limit: 50, default: "draft", null: false - t.boolean "showInUniverse", default: false, null: false - t.datetime "createdAt", precision: 3, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.datetime "updatedAt", precision: 3, null: false - t.jsonb "content" - t.datetime "publishedAt", precision: 3 - t.index ["slug"], name: "Album_slug_idx" - t.index ["slug"], name: "Album_slug_key", unique: true - t.index ["status"], name: "Album_status_idx" - end - - create_table "AlbumMedia", id: :serial, force: :cascade do |t| - t.integer "albumId", null: false - t.integer "mediaId", null: false - t.integer "displayOrder", default: 0, null: false - t.datetime "createdAt", precision: 3, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.index ["albumId", "mediaId"], name: "AlbumMedia_albumId_mediaId_key", unique: true - t.index ["albumId"], name: "AlbumMedia_albumId_idx" - t.index ["mediaId"], name: "AlbumMedia_mediaId_idx" - end - - create_table "GeoLocation", id: :serial, force: :cascade do |t| - t.integer "albumId", null: false - t.float "latitude", null: false - t.float "longitude", null: false - t.string "title", limit: 255, null: false - t.text "description" - t.string "markerColor", limit: 7 - t.integer "order", default: 0, null: false - t.datetime "createdAt", precision: 3, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.datetime "updatedAt", precision: 3, null: false - t.index ["albumId"], name: "GeoLocation_albumId_idx" - end - - create_table "Media", id: :serial, force: :cascade do |t| - t.string "filename", limit: 255, null: false - t.string "mimeType", limit: 100, null: false - t.integer "size", null: false - t.text "url", null: false - t.text "thumbnailUrl" - t.integer "width" - t.integer "height" - t.jsonb "usedIn", default: [], null: false - t.datetime "createdAt", precision: 3, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.text "description" - t.string "originalName", limit: 255 - t.datetime "updatedAt", precision: 3, null: false - t.boolean "isPhotography", default: false, null: false - t.jsonb "exifData" - t.text "photoCaption" - t.string "photoTitle", limit: 255 - t.text "photoDescription" - t.string "photoSlug", limit: 255 - t.datetime "photoPublishedAt", precision: 3 - t.string "dominantColor", limit: 7 - t.jsonb "colors" - t.float "aspectRatio" - t.float "duration" - t.string "videoCodec", limit: 50 - t.string "audioCodec", limit: 50 - t.integer "bitrate" - t.index ["photoSlug"], name: "Media_photoSlug_key", unique: true - end - - create_table "MediaUsage", id: :serial, force: :cascade do |t| - t.integer "mediaId", null: false - t.string "contentType", limit: 50, null: false - t.integer "contentId", null: false - t.string "fieldName", limit: 100, null: false - t.datetime "createdAt", precision: 3, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.datetime "updatedAt", precision: 3, null: false - t.index ["contentType", "contentId"], name: "MediaUsage_contentType_contentId_idx" - t.index ["mediaId", "contentType", "contentId", "fieldName"], name: "MediaUsage_mediaId_contentType_contentId_fieldName_key", unique: true - t.index ["mediaId"], name: "MediaUsage_mediaId_idx" - end - - create_table "Photo", id: :serial, force: :cascade do |t| - t.string "filename", limit: 255, null: false - t.string "url", limit: 500, null: false - t.string "thumbnailUrl", limit: 500 - t.integer "width" - t.integer "height" - t.jsonb "exifData" - t.text "caption" - t.integer "displayOrder", default: 0, null: false - t.string "slug", limit: 255 - t.string "title", limit: 255 - t.text "description" - t.string "status", limit: 50, default: "draft", null: false - t.datetime "publishedAt", precision: 3 - t.boolean "showInPhotos", default: true, null: false - t.datetime "createdAt", precision: 3, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.integer "mediaId" - t.string "dominantColor", limit: 7 - t.jsonb "colors" - t.float "aspectRatio" - t.index ["mediaId"], name: "Photo_mediaId_idx" - t.index ["slug"], name: "Photo_slug_idx" - t.index ["slug"], name: "Photo_slug_key", unique: true - t.index ["status"], name: "Photo_status_idx" - end - - create_table "Post", id: :serial, force: :cascade do |t| - t.string "slug", limit: 255, null: false - t.string "postType", limit: 50, null: false - t.string "title", limit: 255 - t.jsonb "content" - t.string "featuredImage", limit: 500 - t.jsonb "tags" - t.string "status", limit: 50, default: "draft", null: false - t.datetime "publishedAt", precision: 3 - t.datetime "createdAt", precision: 3, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.datetime "updatedAt", precision: 3, null: false - t.jsonb "attachments" - t.index ["postType"], name: "Post_postType_idx" - t.index ["slug"], name: "Post_slug_idx" - t.index ["slug"], name: "Post_slug_key", unique: true - t.index ["status"], name: "Post_status_idx" - end - - create_table "Project", id: :serial, force: :cascade do |t| - t.string "slug", limit: 255, null: false - t.string "title", limit: 255, null: false - t.string "subtitle", limit: 255 - t.text "description" - t.integer "year", null: false - t.string "client", limit: 255 - t.string "role", limit: 255 - t.string "featuredImage", limit: 500 - t.jsonb "gallery" - t.string "externalUrl", limit: 500 - t.jsonb "caseStudyContent" - t.integer "displayOrder", default: 0, null: false - t.string "status", limit: 50, default: "draft", null: false - t.datetime "publishedAt", precision: 3 - t.datetime "createdAt", precision: 3, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.datetime "updatedAt", precision: 3, null: false - t.string "backgroundColor", limit: 50 - t.string "highlightColor", limit: 50 - t.string "logoUrl", limit: 500 - t.string "password", limit: 255 - t.string "projectType", limit: 50, default: "work", null: false - t.boolean "showBackgroundColorInHeader", default: true, null: false - t.boolean "showFeaturedImageInHeader", default: true, null: false - t.boolean "showLogoInHeader", default: true, null: false - t.index ["slug"], name: "Project_slug_idx" - t.index ["slug"], name: "Project_slug_key", unique: true - t.index ["status"], name: "Project_status_idx" - end - - create_table "_prisma_migrations", id: { type: :string, limit: 36 }, force: :cascade do |t| - t.string "checksum", limit: 64, null: false - t.timestamptz "finished_at" - t.string "migration_name", limit: 255, null: false - t.text "logs" - t.timestamptz "rolled_back_at" - t.timestamptz "started_at", default: -> { "now()" }, null: false - t.integer "applied_steps_count", default: 0, null: false - end create_table "app_updates", primary_key: "updated_at", id: :datetime, force: :cascade do |t| t.string "update_type", null: false @@ -797,8 +628,10 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_02_120531) do t.text "wiki_raw" t.jsonb "game_raw_en", comment: "JSON data from game (English)" t.jsonb "game_raw_jp", comment: "JSON data from game (Japanese)" + t.integer "promotions", default: [], null: false, array: true t.index ["granblue_id"], name: "index_summons_on_granblue_id" t.index ["name_en"], name: "index_summons_on_name_en", opclass: :gin_trgm_ops, using: :gin + t.index ["promotions"], name: "index_summons_on_promotions", using: :gin end create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -894,16 +727,13 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_02_120531) do t.text "wiki_raw" t.jsonb "game_raw_en", comment: "JSON data from game (English)" t.jsonb "game_raw_jp", comment: "JSON data from game (Japanese)" + t.integer "promotions", default: [], null: false, array: true t.index ["granblue_id"], name: "index_weapons_on_granblue_id" t.index ["name_en"], name: "index_weapons_on_name_en", opclass: :gin_trgm_ops, using: :gin + t.index ["promotions"], name: "index_weapons_on_promotions", using: :gin t.index ["recruits"], name: "index_weapons_on_recruits" end - add_foreign_key "AlbumMedia", "Album", column: "albumId", name: "AlbumMedia_albumId_fkey", on_update: :cascade, on_delete: :cascade - add_foreign_key "AlbumMedia", "Media", column: "mediaId", name: "AlbumMedia_mediaId_fkey", on_update: :cascade, on_delete: :cascade - add_foreign_key "GeoLocation", "Album", column: "albumId", name: "GeoLocation_albumId_fkey", on_update: :cascade, on_delete: :cascade - add_foreign_key "MediaUsage", "Media", column: "mediaId", name: "MediaUsage_mediaId_fkey", on_update: :cascade, on_delete: :cascade - add_foreign_key "Photo", "Media", column: "mediaId", name: "Photo_mediaId_fkey", on_update: :cascade, on_delete: :nullify add_foreign_key "character_skills", "skills" add_foreign_key "character_skills", "skills", column: "alt_skill_id" add_foreign_key "charge_attacks", "skills"