|
|
|
@ -27,20 +27,23 @@ CREATE TABLE IF NOT EXISTS hero_gear (
|
|
|
|
);
|
|
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_hero_gear_hero ON hero_gear(hero_id);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_hero_gear_hero ON hero_gear(hero_id);
|
|
|
|
|
|
|
|
|
|
|
|
-- Migrate existing weapon data to gear table
|
|
|
|
-- Migrate existing weapon data to gear table (safe to re-run if migration retried)
|
|
|
|
INSERT INTO gear (id, slot, name, subtype, rarity, ilvl, base_primary, primary_stat, stat_type, speed_modifier, crit_chance, special_effect)
|
|
|
|
INSERT INTO gear (id, slot, name, subtype, rarity, ilvl, base_primary, primary_stat, stat_type, speed_modifier, crit_chance, special_effect)
|
|
|
|
SELECT id, 'main_hand', name, type, rarity, ilvl, damage, damage, 'attack', speed, crit_chance, special_effect
|
|
|
|
SELECT id, 'main_hand', name, type, rarity, ilvl, damage, damage, 'attack', speed, crit_chance, special_effect
|
|
|
|
FROM weapons;
|
|
|
|
FROM weapons
|
|
|
|
|
|
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
|
|
|
|
|
|
|
|
-- Migrate existing armor data to gear table (offset IDs by 1000 to avoid conflicts)
|
|
|
|
-- Migrate existing armor data to gear table (offset IDs by 1000 to avoid conflicts)
|
|
|
|
INSERT INTO gear (id, slot, name, subtype, rarity, ilvl, base_primary, primary_stat, stat_type, speed_modifier, agility_bonus, set_name, special_effect)
|
|
|
|
INSERT INTO gear (id, slot, name, subtype, rarity, ilvl, base_primary, primary_stat, stat_type, speed_modifier, agility_bonus, set_name, special_effect)
|
|
|
|
SELECT id + 1000, 'chest', name, type, rarity, ilvl, defense, defense, 'defense', speed_modifier, agility_bonus, set_name, special_effect
|
|
|
|
SELECT id + 1000, 'chest', name, type, rarity, ilvl, defense, defense, 'defense', speed_modifier, agility_bonus, set_name, special_effect
|
|
|
|
FROM armor;
|
|
|
|
FROM armor
|
|
|
|
|
|
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
|
|
|
|
|
|
|
|
-- Migrate equipment_items to gear (offset by 2000)
|
|
|
|
-- Migrate equipment_items to gear (offset by 2000)
|
|
|
|
INSERT INTO gear (id, slot, form_id, name, rarity, ilvl, base_primary, primary_stat, stat_type)
|
|
|
|
INSERT INTO gear (id, slot, form_id, name, rarity, ilvl, base_primary, primary_stat, stat_type)
|
|
|
|
SELECT id + 2000, slot, form_id, name, rarity, ilvl, base_primary, primary_stat, stat_type
|
|
|
|
SELECT id + 2000, slot, form_id, name, rarity, ilvl, base_primary, primary_stat, stat_type
|
|
|
|
FROM equipment_items;
|
|
|
|
FROM equipment_items
|
|
|
|
|
|
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
|
|
|
|
|
|
|
|
-- Migrate hero weapon/armor refs to hero_gear
|
|
|
|
-- Migrate hero weapon/armor refs to hero_gear
|
|
|
|
INSERT INTO hero_gear (hero_id, slot, gear_id)
|
|
|
|
INSERT INTO hero_gear (hero_id, slot, gear_id)
|
|
|
|
|