add reroll_slot to artifact models
This commit is contained in:
parent
183641b842
commit
e6539ad7e1
4 changed files with 13 additions and 1 deletions
|
|
@ -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) }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue