hensei-api/db/migrate/20251230000002_add_weapon_stat_modifier_fks.rb
Justin Edmund 1f80e4189f
Add weapon stat modifiers for AX skills and befoulments (#202)
* add weapon_stat_modifiers table for ax skills and befoulments

* add fk columns for ax modifiers and befoulments, replace has_ax_skills with augment_type

* update models for weapon_stat_modifier fks and befoulments

* update blueprints for weapon_stat_modifier serialization

* update import service for weapon_stat_modifier fks and befoulments

* add weapon_stat_modifiers controller and update params for fks

* update tests and factories for weapon_stat_modifier fks

* fix remaining has_ax_skills and ax_modifier references

* add ax_modifier and befoulment_modifier to eager loading

* fix ax modifier column naming and migration approach

* add game_skill_ids for befoulment modifiers
2025-12-31 22:20:00 -08:00

36 lines
1.7 KiB
Ruby

# frozen_string_literal: true
class AddWeaponStatModifierFks < ActiveRecord::Migration[8.0]
def change
# collection_weapons - add FK columns
# Note: old ax_modifier1/ax_modifier2 integer columns still exist for data migration
add_column :collection_weapons, :ax_modifier1_id, :bigint
add_column :collection_weapons, :ax_modifier2_id, :bigint
add_column :collection_weapons, :befoulment_modifier_id, :bigint
add_column :collection_weapons, :befoulment_strength, :float
add_column :collection_weapons, :exorcism_level, :integer, default: 0
add_index :collection_weapons, :ax_modifier1_id
add_index :collection_weapons, :ax_modifier2_id
add_index :collection_weapons, :befoulment_modifier_id
add_foreign_key :collection_weapons, :weapon_stat_modifiers, column: :ax_modifier1_id
add_foreign_key :collection_weapons, :weapon_stat_modifiers, column: :ax_modifier2_id
add_foreign_key :collection_weapons, :weapon_stat_modifiers, column: :befoulment_modifier_id
# grid_weapons - same pattern
add_column :grid_weapons, :ax_modifier1_id, :bigint
add_column :grid_weapons, :ax_modifier2_id, :bigint
add_column :grid_weapons, :befoulment_modifier_id, :bigint
add_column :grid_weapons, :befoulment_strength, :float
add_column :grid_weapons, :exorcism_level, :integer, default: 0
add_index :grid_weapons, :ax_modifier1_id
add_index :grid_weapons, :ax_modifier2_id
add_index :grid_weapons, :befoulment_modifier_id
add_foreign_key :grid_weapons, :weapon_stat_modifiers, column: :ax_modifier1_id
add_foreign_key :grid_weapons, :weapon_stat_modifiers, column: :ax_modifier2_id
add_foreign_key :grid_weapons, :weapon_stat_modifiers, column: :befoulment_modifier_id
end
end