diff --git a/app/models/collection_artifact.rb b/app/models/collection_artifact.rb index 1c7b75b..35f43fb 100644 --- a/app/models/collection_artifact.rb +++ b/app/models/collection_artifact.rb @@ -38,6 +38,7 @@ class CollectionArtifact < ApplicationRecord validates :nickname, length: { maximum: 50 }, allow_blank: true validates :proficiency, presence: true, if: :quirk_artifact? validates :proficiency, absence: true, unless: :quirk_artifact? + validates :reroll_slot, inclusion: { in: 1..4 }, allow_nil: true # Scopes scope :by_element, ->(el) { where(element: el) } diff --git a/app/models/grid_artifact.rb b/app/models/grid_artifact.rb index 77a8db7..e6ef66f 100644 --- a/app/models/grid_artifact.rb +++ b/app/models/grid_artifact.rb @@ -40,6 +40,7 @@ class GridArtifact < ApplicationRecord validates :level, presence: true, inclusion: { in: 1..5 } validates :proficiency, presence: true, if: :quirk_artifact? validates :proficiency, absence: true, unless: :quirk_artifact? + validates :reroll_slot, inclusion: { in: 1..4 }, allow_nil: true validate :validate_character_compatibility diff --git a/db/migrate/20251203211939_add_reroll_slot_to_artifacts.rb b/db/migrate/20251203211939_add_reroll_slot_to_artifacts.rb new file mode 100644 index 0000000..93142c9 --- /dev/null +++ b/db/migrate/20251203211939_add_reroll_slot_to_artifacts.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddRerollSlotToArtifacts < ActiveRecord::Migration[8.0] + def change + add_column :collection_artifacts, :reroll_slot, :integer + add_column :grid_artifacts, :reroll_slot, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 843ac3b..76d973a 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[8.0].define(version: 2025_12_03_195857) do +ActiveRecord::Schema[8.0].define(version: 2025_12_03_211939) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "pg_catalog.plpgsql" @@ -150,6 +150,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_03_195857) do t.jsonb "skill4", default: {}, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.integer "reroll_slot" t.index ["artifact_id"], name: "index_collection_artifacts_on_artifact_id" t.index ["element"], name: "index_collection_artifacts_on_element" t.index ["user_id", "artifact_id"], name: "index_collection_artifacts_on_user_id_and_artifact_id" @@ -298,6 +299,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_03_195857) do t.jsonb "skill4", default: {}, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.integer "reroll_slot" t.index ["artifact_id"], name: "index_grid_artifacts_on_artifact_id" t.index ["grid_character_id"], name: "index_grid_artifacts_on_grid_character_id", unique: true end