add video_url and summon_count to parties

This commit is contained in:
Justin Edmund 2025-12-21 02:56:22 -08:00
parent 847a487920
commit 25aa1f3a62
3 changed files with 16 additions and 2 deletions

View file

@ -200,8 +200,13 @@ class Party < ApplicationRecord
validates :button_count, numericality: { only_integer: true }, allow_nil: true
validates :chain_count, numericality: { only_integer: true }, allow_nil: true
validates :turn_count, numericality: { only_integer: true }, allow_nil: true
validates :summon_count, numericality: { only_integer: true }, allow_nil: true
validates :ultimate_mastery, numericality: { only_integer: true }, allow_nil: true
# YouTube URL validation regex
YOUTUBE_REGEX = %r{\A(?:https?://)?(?:www\.)?(?:youtube\.com/watch\?v=|youtu\.be/)[\w-]+}
validates :video_url, format: { with: YOUTUBE_REGEX, message: 'must be a valid YouTube URL' }, allow_blank: true
# Validate visibility (allowed values: 1, 2, or 3).
validates :visibility,
numericality: { only_integer: true },

View file

@ -0,0 +1,8 @@
# frozen_string_literal: true
class AddVideoUrlAndSummonCountToParties < ActiveRecord::Migration[8.0]
def change
add_column :parties, :video_url, :string, limit: 2048
add_column :parties, :summon_count, :integer
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_12_20_014422) do
ActiveRecord::Schema[8.0].define(version: 2025_12_20_100000) do
# These are extensions that must be enabled in order to support this database
enable_extension "btree_gin"
enable_extension "pg_catalog.plpgsql"
@ -135,7 +135,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_20_014422) 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.text "game_raw_en_backup"
t.integer "season"
t.integer "series", default: [], null: false, array: true
t.index ["granblue_id"], name: "index_characters_on_granblue_id"
@ -637,6 +636,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_20_014422) do
t.integer "preview_state", default: 0, null: false
t.datetime "preview_generated_at"
t.string "preview_s3_key"
t.string "video_url", limit: 2048
t.integer "summon_count"
t.index ["accessory_id"], name: "index_parties_on_accessory_id"
t.index ["created_at"], name: "index_parties_on_created_at"
t.index ["element"], name: "index_parties_on_element"