- Add ArtifactImportService to parse game JSON and create collection artifacts - Maps game skill_id to our (group, modifier) format using verified mapping - Handles skill quality -> strength lookup via ArtifactSkill.base_values - Supports duplicate detection via game_id, with optional update_existing flag - Quirk artifacts get proficiency from game data; skills stored as empty - Add POST /collection/artifacts/import endpoint - Add game_id column to collection_artifacts, collection_weapons, collection_summons for tracking game inventory instance IDs
18 lines
802 B
Ruby
18 lines
802 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddGameIdToCollectionItems < ActiveRecord::Migration[8.0]
|
|
def change
|
|
# Add game_id to collection_artifacts
|
|
# This stores the unique instance ID from the game's inventory (the "id" field in game data)
|
|
add_column :collection_artifacts, :game_id, :string
|
|
add_index :collection_artifacts, %i[user_id game_id], unique: true, where: 'game_id IS NOT NULL'
|
|
|
|
# Add game_id to collection_weapons
|
|
add_column :collection_weapons, :game_id, :string
|
|
add_index :collection_weapons, %i[user_id game_id], unique: true, where: 'game_id IS NOT NULL'
|
|
|
|
# Add game_id to collection_summons
|
|
add_column :collection_summons, :game_id, :string
|
|
add_index :collection_summons, %i[user_id game_id], unique: true, where: 'game_id IS NOT NULL'
|
|
end
|
|
end
|