Merge branch 'master' into hotfix/issue4984
This commit is contained in:
@@ -5641,11 +5641,11 @@ REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_sha
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24344,'S_Blitz_Armor','Blitz Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bDef,25+5*(.@r/2);\nif (.@r >= 7) {\n bonus bAspd,1;\n if (.@r >= 9) {\n bonus bDelayrate,-1;\n }\n}');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shield`,`equip_level_min`,`refineable`,`script`) VALUES (24345,'S_Tempest_Shield','Tempest Shadow Shield','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus2 bIgnoreMdefClassRate,Class_Normal,5+(.@r/2);');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shoes`,`equip_level_min`,`refineable`,`script`) VALUES (24346,'S_Tempest_Shoes','Tempest Shadow Shoes','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus2 bIgnoreMdefClassRate,Class_Normal,5+(.@r/2);');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24347,'S_Magic_Executioner_Holy_Water_Armor','Magic Executioner Holy Water Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_DemiHuman,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Undead,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24348,'S_Magic_Exorcist_Corrupted_Armor','Magic Exorcist Corrupted Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Demon,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Angel,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24349,'S_Magic_Vibration_Dragon_Killer_Armor','Magic Vibration Dragon Killer Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Formless,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Dragon,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24350,'S_Magic_Scissor_Hunting_Armor','Magic Scissor Hunting Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Plant,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Brute,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Player_Doram,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24351,'S_Magic_Fishing_Insect_Net_Armor','Magic Fishing Insect Net Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Fish,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Insect,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24347,'S_M_ExeHoly_Armor','Magic Executioner Holy Water Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_DemiHuman,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Undead,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24348,'S_M_ExoCorrupt_Armor','Magic Exorcist Corrupted Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Demon,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Angel,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24349,'S_M_DragonVib_Armor','Magic Vibration Dragon Killer Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Formless,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Dragon,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24350,'S_M_SciHunting_Armor','Magic Scissor Hunting Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Plant,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Brute,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Player_Doram,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24351,'S_M_FishInsect_Armor','Magic Fishing Insect Net Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Fish,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Insect,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24352,'S_Plasterer\'s_Armor_II','Plasterer\'s Shadow Armor II','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bDef,1;\nbonus2 bResEff,Eff_Stone,100*.@r;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shoes`,`equip_level_min`,`refineable`,`script`) VALUES (24353,'S_Insomniac_Shoes_II','Insomniac Shadow Shoes II','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bDef,1;\nbonus2 bResEff,Eff_Sleep,100*.@r;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24354,'S_Peerless_Armor_II','Peerless Shadow Armor II','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bDef,1;\nbonus2 bResEff,Eff_Silence,100*.@r;');
|
||||
@@ -5669,11 +5669,11 @@ REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_sha
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_left_accessory`,`equip_level_min`,`refineable`,`script`) VALUES (24372,'S_Mortal_Blow_Pendant','Mortal Blow Shadow Pendant','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nif (.@r >= 9) {\n .@val = 3;\n} else if (.@r >= 7) {\n .@val = 2;\n}\nelse {\n .@val = 1;\n}\nbonus bCritAtkRate,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shoes`,`equip_level_min`,`refineable`,`script`) VALUES (24373,'S_Penetration_Shoes','Penetration Shadow Shoes','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus2 bIgnoreDefClassRate,Class_Normal,5+(.@r/2);');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shield`,`equip_level_min`,`refineable`,`script`) VALUES (24374,'S_Penetration_Shield','Penetration Shadow Shield','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus2 bIgnoreDefClassRate,Class_Normal,5+(.@r/2);');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24375,'S_Executioner_Holy_Water_Armor','Executioner Holy Water Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_DemiHuman,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Undead,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24376,'S_Exorcist_Corrupted_Armor','Exorcist Corrupted Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Demon,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Angel,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24377,'S_Vibration_Dragon_Killer_Armor','Vibration Dragon Killer Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Formless,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Dragon,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24378,'S_Scissor_Hunting_Armor','Scissor Hunting Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Plant,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Brute,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24379,'S_Fishing_Insect_Net_Armor','Fishing Insect Net Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Fish,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Insect,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24375,'S_ExeHoly_Armor','Executioner Holy Water Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_DemiHuman,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Undead,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24376,'S_ExoCorrupt_Armor','Exorcist Corrupted Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Demon,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Angel,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24377,'S_DragonVib_Armor','Vibration Dragon Killer Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Formless,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Dragon,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24378,'S_SciHunting_Armor','Scissor Hunting Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Plant,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Brute,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24379,'S_FishInsect_Armor','Fishing Insect Net Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Fish,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Insect,.@val;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_weapon`,`equip_level_min`,`refineable`,`script`) VALUES (24380,'Sentimental_Weapone_S','Sentimental Shadow Weapon','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bBaseAtk,.@r;\nbonus bMatk,.@r;\nbonus bMaxSP,10+((.@r/2)*15);');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_right_accessory`,`equip_level_min`,`refineable`,`script`) VALUES (24381,'Sentimental_Earring_S','Sentimental Shadow Earring','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bMaxSP,(.@r/2)*5;\nbonus bMaxSPrate,1;\nbonus bBaseAtk,5;');
|
||||
REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_left_accessory`,`equip_level_min`,`refineable`,`script`) VALUES (24382,'Sentimental_Pendant_S','Sentimental Shadow Pendant','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bSPrecovRate,2+.@r/3;\nbonus bBaseAtk,5;');
|
||||
|
||||
@@ -975,6 +975,27 @@ CREATE TABLE IF NOT EXISTS `party` (
|
||||
PRIMARY KEY (`party_id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
--
|
||||
-- Table structure for table `party_bookings`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `party_bookings` (
|
||||
`world_name` varchar(32) NOT NULL,
|
||||
`account_id` int(11) unsigned NOT NULL,
|
||||
`char_id` int(11) unsigned NOT NULL,
|
||||
`char_name` varchar(23) NOT NULL,
|
||||
`purpose` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`assist` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`damagedealer` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`healer` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`tanker` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`minimum_level` smallint(5) unsigned NOT NULL,
|
||||
`maximum_level` smallint(5) unsigned NOT NULL,
|
||||
`comment` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`world_name`, `account_id`, `char_id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
--
|
||||
-- Table structure for table `pet`
|
||||
--
|
||||
|
||||
823
sql-files/upgrades/upgrade_20221218.sql
Normal file
823
sql-files/upgrades/upgrade_20221218.sql
Normal file
@@ -0,0 +1,823 @@
|
||||
/**
|
||||
ATTENTION!!!
|
||||
Please make sure to create a backup of your live data before running this update.
|
||||
This update is rather complicated and although I have tried my best I cannot guarantee that I did not make any mistake. [Lemongrass]
|
||||
We would also advise you to check the data in the temporary table after the insert statement and before the update statements.
|
||||
You could do so by running
|
||||
select * from `tmp_randomoptionfix` where `new_index` <> `old_index`;
|
||||
to see where changes happen and options will be moved.
|
||||
For executing this update your user needs create table and drop table permissions. Either run the update with another user [admin or root for example] or give your database user these permissions temporarily.
|
||||
Do not forget to remove these permissions again, as they are usually not necessary and it is rather dangerous, if someone gets access to your database user.
|
||||
Additionally if you have more than one storage table (see conf/inter_server.yml) make sure to also update those tables (see instructions at the bottom of this script).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Comment the line below to really run the script, this is a safeguard that you confirm you have read and understood what was written above.
|
||||
**/
|
||||
cancel;
|
||||
|
||||
-- Create a temporary table to store the data for the update
|
||||
create table `tmp_randomoptionfix` (
|
||||
`id` int(11) unsigned NOT NULL,
|
||||
`new_index` smallint(5) NOT NULL,
|
||||
`old_index` smallint(5) NOT NULL,
|
||||
`option_id` smallint(5) NOT NULL,
|
||||
`option_val` smallint(5) NOT NULL,
|
||||
`option_parm` tinyint(3) NOT NULL,
|
||||
PRIMARY KEY ( `id`, `old_index` )
|
||||
);
|
||||
|
||||
-- Create auction data
|
||||
insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
|
||||
select
|
||||
`id`,
|
||||
row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
|
||||
`old_index`,
|
||||
`option_id`,
|
||||
`option_val`,
|
||||
`option_parm`
|
||||
from (
|
||||
select * from (
|
||||
select
|
||||
`auction_id` as `id`,
|
||||
0 as `old_index`,
|
||||
`option_id0` as `option_id`,
|
||||
`option_val0` as `option_val`,
|
||||
`option_parm0` as `option_parm`
|
||||
from `auction`
|
||||
where `option_id0` <> 0
|
||||
union
|
||||
select
|
||||
`auction_id` as `id`,
|
||||
1 as `old_index`,
|
||||
`option_id1` as `option_id`,
|
||||
`option_val1` as `option_val`,
|
||||
`option_parm1` as `option_parm`
|
||||
from `auction`
|
||||
where `option_id1` <> 0
|
||||
union
|
||||
select
|
||||
`auction_id` as `id`,
|
||||
2 as `old_index`,
|
||||
`option_id2` as `option_id`,
|
||||
`option_val2` as `option_val`,
|
||||
`option_parm2` as `option_parm`
|
||||
from `auction`
|
||||
where `option_id2` <> 0
|
||||
union
|
||||
select
|
||||
`auction_id` as `id`,
|
||||
3 as `old_index`,
|
||||
`option_id3` as `option_id`,
|
||||
`option_val3` as `option_val`,
|
||||
`option_parm3` as `option_parm`
|
||||
from `auction`
|
||||
where `option_id3` <> 0
|
||||
union
|
||||
select
|
||||
`auction_id` as `id`,
|
||||
4 as `old_index`,
|
||||
`option_id4` as `option_id`,
|
||||
`option_val4` as `option_val`,
|
||||
`option_parm4` as `option_parm`
|
||||
from `auction`
|
||||
where `option_id4` <> 0
|
||||
) t2
|
||||
order by `id`, `old_index`
|
||||
) t ;
|
||||
|
||||
-- Fix option 0
|
||||
update `auction`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
|
||||
set
|
||||
`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 1
|
||||
update `auction`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
|
||||
set
|
||||
`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 2
|
||||
update `auction`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
|
||||
set
|
||||
`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 3
|
||||
update `auction`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
|
||||
set
|
||||
`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 4
|
||||
update `auction`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
|
||||
set
|
||||
`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Delete the data to have a clean table for the next run
|
||||
delete from `tmp_randomoptionfix`;
|
||||
|
||||
-- Create cart_inventory data
|
||||
insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
|
||||
select
|
||||
`id`,
|
||||
row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
|
||||
`old_index`,
|
||||
`option_id`,
|
||||
`option_val`,
|
||||
`option_parm`
|
||||
from (
|
||||
select * from (
|
||||
select
|
||||
`id`,
|
||||
0 as `old_index`,
|
||||
`option_id0` as `option_id`,
|
||||
`option_val0` as `option_val`,
|
||||
`option_parm0` as `option_parm`
|
||||
from `cart_inventory`
|
||||
where `option_id0` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
1 as `old_index`,
|
||||
`option_id1` as `option_id`,
|
||||
`option_val1` as `option_val`,
|
||||
`option_parm1` as `option_parm`
|
||||
from `cart_inventory`
|
||||
where `option_id1` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
2 as `old_index`,
|
||||
`option_id2` as `option_id`,
|
||||
`option_val2` as `option_val`,
|
||||
`option_parm2` as `option_parm`
|
||||
from `cart_inventory`
|
||||
where `option_id2` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
3 as `old_index`,
|
||||
`option_id3` as `option_id`,
|
||||
`option_val3` as `option_val`,
|
||||
`option_parm3` as `option_parm`
|
||||
from `cart_inventory`
|
||||
where `option_id3` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
4 as `old_index`,
|
||||
`option_id4` as `option_id`,
|
||||
`option_val4` as `option_val`,
|
||||
`option_parm4` as `option_parm`
|
||||
from `cart_inventory`
|
||||
where `option_id4` <> 0
|
||||
) t2
|
||||
order by `id`, `old_index`
|
||||
) t ;
|
||||
|
||||
-- Fix option 0
|
||||
update `cart_inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
|
||||
set
|
||||
`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 1
|
||||
update `cart_inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
|
||||
set
|
||||
`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 2
|
||||
update `cart_inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
|
||||
set
|
||||
`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 3
|
||||
update `cart_inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
|
||||
set
|
||||
`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 4
|
||||
update `cart_inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
|
||||
set
|
||||
`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Delete the data to have a clean table for the next run
|
||||
delete from `tmp_randomoptionfix`;
|
||||
|
||||
-- Create guild_storage data
|
||||
insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
|
||||
select
|
||||
`id`,
|
||||
row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
|
||||
`old_index`,
|
||||
`option_id`,
|
||||
`option_val`,
|
||||
`option_parm`
|
||||
from (
|
||||
select * from (
|
||||
select
|
||||
`id`,
|
||||
0 as `old_index`,
|
||||
`option_id0` as `option_id`,
|
||||
`option_val0` as `option_val`,
|
||||
`option_parm0` as `option_parm`
|
||||
from `guild_storage`
|
||||
where `option_id0` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
1 as `old_index`,
|
||||
`option_id1` as `option_id`,
|
||||
`option_val1` as `option_val`,
|
||||
`option_parm1` as `option_parm`
|
||||
from `guild_storage`
|
||||
where `option_id1` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
2 as `old_index`,
|
||||
`option_id2` as `option_id`,
|
||||
`option_val2` as `option_val`,
|
||||
`option_parm2` as `option_parm`
|
||||
from `guild_storage`
|
||||
where `option_id2` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
3 as `old_index`,
|
||||
`option_id3` as `option_id`,
|
||||
`option_val3` as `option_val`,
|
||||
`option_parm3` as `option_parm`
|
||||
from `guild_storage`
|
||||
where `option_id3` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
4 as `old_index`,
|
||||
`option_id4` as `option_id`,
|
||||
`option_val4` as `option_val`,
|
||||
`option_parm4` as `option_parm`
|
||||
from `guild_storage`
|
||||
where `option_id4` <> 0
|
||||
) t2
|
||||
order by `id`, `old_index`
|
||||
) t ;
|
||||
|
||||
-- Fix option 0
|
||||
update `guild_storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
|
||||
set
|
||||
`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 1
|
||||
update `guild_storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
|
||||
set
|
||||
`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 2
|
||||
update `guild_storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
|
||||
set
|
||||
`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 3
|
||||
update `guild_storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
|
||||
set
|
||||
`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 4
|
||||
update `guild_storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
|
||||
set
|
||||
`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Delete the data to have a clean table for the next run
|
||||
delete from `tmp_randomoptionfix`;
|
||||
|
||||
-- Create inventory data
|
||||
insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
|
||||
select
|
||||
`id`,
|
||||
row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
|
||||
`old_index`,
|
||||
`option_id`,
|
||||
`option_val`,
|
||||
`option_parm`
|
||||
from (
|
||||
select * from (
|
||||
select
|
||||
`id`,
|
||||
0 as `old_index`,
|
||||
`option_id0` as `option_id`,
|
||||
`option_val0` as `option_val`,
|
||||
`option_parm0` as `option_parm`
|
||||
from `inventory`
|
||||
where `option_id0` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
1 as `old_index`,
|
||||
`option_id1` as `option_id`,
|
||||
`option_val1` as `option_val`,
|
||||
`option_parm1` as `option_parm`
|
||||
from `inventory`
|
||||
where `option_id1` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
2 as `old_index`,
|
||||
`option_id2` as `option_id`,
|
||||
`option_val2` as `option_val`,
|
||||
`option_parm2` as `option_parm`
|
||||
from `inventory`
|
||||
where `option_id2` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
3 as `old_index`,
|
||||
`option_id3` as `option_id`,
|
||||
`option_val3` as `option_val`,
|
||||
`option_parm3` as `option_parm`
|
||||
from `inventory`
|
||||
where `option_id3` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
4 as `old_index`,
|
||||
`option_id4` as `option_id`,
|
||||
`option_val4` as `option_val`,
|
||||
`option_parm4` as `option_parm`
|
||||
from `inventory`
|
||||
where `option_id4` <> 0
|
||||
) t2
|
||||
order by `id`, `old_index`
|
||||
) t ;
|
||||
|
||||
-- Fix option 0
|
||||
update `inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
|
||||
set
|
||||
`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 1
|
||||
update `inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
|
||||
set
|
||||
`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 2
|
||||
update `inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
|
||||
set
|
||||
`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 3
|
||||
update `inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
|
||||
set
|
||||
`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 4
|
||||
update `inventory`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
|
||||
set
|
||||
`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Delete the data to have a clean table for the next run
|
||||
delete from `tmp_randomoptionfix`;
|
||||
|
||||
-- Create mail_attachments data
|
||||
insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
|
||||
select
|
||||
`id`,
|
||||
row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
|
||||
`old_index`,
|
||||
`option_id`,
|
||||
`option_val`,
|
||||
`option_parm`
|
||||
from (
|
||||
select * from (
|
||||
select
|
||||
`id`,
|
||||
0 as `old_index`,
|
||||
`option_id0` as `option_id`,
|
||||
`option_val0` as `option_val`,
|
||||
`option_parm0` as `option_parm`
|
||||
from `mail_attachments`
|
||||
where `option_id0` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
1 as `old_index`,
|
||||
`option_id1` as `option_id`,
|
||||
`option_val1` as `option_val`,
|
||||
`option_parm1` as `option_parm`
|
||||
from `mail_attachments`
|
||||
where `option_id1` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
2 as `old_index`,
|
||||
`option_id2` as `option_id`,
|
||||
`option_val2` as `option_val`,
|
||||
`option_parm2` as `option_parm`
|
||||
from `mail_attachments`
|
||||
where `option_id2` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
3 as `old_index`,
|
||||
`option_id3` as `option_id`,
|
||||
`option_val3` as `option_val`,
|
||||
`option_parm3` as `option_parm`
|
||||
from `mail_attachments`
|
||||
where `option_id3` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
4 as `old_index`,
|
||||
`option_id4` as `option_id`,
|
||||
`option_val4` as `option_val`,
|
||||
`option_parm4` as `option_parm`
|
||||
from `mail_attachments`
|
||||
where `option_id4` <> 0
|
||||
) t2
|
||||
order by `id`, `old_index`
|
||||
) t ;
|
||||
|
||||
-- Fix option 0
|
||||
update `mail_attachments`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
|
||||
set
|
||||
`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 1
|
||||
update `mail_attachments`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
|
||||
set
|
||||
`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 2
|
||||
update `mail_attachments`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
|
||||
set
|
||||
`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 3
|
||||
update `mail_attachments`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
|
||||
set
|
||||
`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 4
|
||||
update `mail_attachments`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
|
||||
set
|
||||
`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Delete the data to have a clean table for the next run
|
||||
delete from `tmp_randomoptionfix`;
|
||||
|
||||
-- Create storage data
|
||||
insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
|
||||
select
|
||||
`id`,
|
||||
row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
|
||||
`old_index`,
|
||||
`option_id`,
|
||||
`option_val`,
|
||||
`option_parm`
|
||||
from (
|
||||
select * from (
|
||||
select
|
||||
`id`,
|
||||
0 as `old_index`,
|
||||
`option_id0` as `option_id`,
|
||||
`option_val0` as `option_val`,
|
||||
`option_parm0` as `option_parm`
|
||||
from `storage`
|
||||
where `option_id0` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
1 as `old_index`,
|
||||
`option_id1` as `option_id`,
|
||||
`option_val1` as `option_val`,
|
||||
`option_parm1` as `option_parm`
|
||||
from `storage`
|
||||
where `option_id1` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
2 as `old_index`,
|
||||
`option_id2` as `option_id`,
|
||||
`option_val2` as `option_val`,
|
||||
`option_parm2` as `option_parm`
|
||||
from `storage`
|
||||
where `option_id2` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
3 as `old_index`,
|
||||
`option_id3` as `option_id`,
|
||||
`option_val3` as `option_val`,
|
||||
`option_parm3` as `option_parm`
|
||||
from `storage`
|
||||
where `option_id3` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
4 as `old_index`,
|
||||
`option_id4` as `option_id`,
|
||||
`option_val4` as `option_val`,
|
||||
`option_parm4` as `option_parm`
|
||||
from `storage`
|
||||
where `option_id4` <> 0
|
||||
) t2
|
||||
order by `id`, `old_index`
|
||||
) t ;
|
||||
|
||||
-- Fix option 0
|
||||
update `storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
|
||||
set
|
||||
`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 1
|
||||
update `storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
|
||||
set
|
||||
`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 2
|
||||
update `storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
|
||||
set
|
||||
`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 3
|
||||
update `storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
|
||||
set
|
||||
`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 4
|
||||
update `storage`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
|
||||
set
|
||||
`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Delete the data to have a clean table for the next run
|
||||
delete from `tmp_randomoptionfix`;
|
||||
|
||||
-- Repeat this for any other storage tables that you have created (for example VIP)
|
||||
-- To do this copy paste the code below and replace ${other_storage} with the name of your table
|
||||
/**
|
||||
-- Create ${other_storage} data
|
||||
insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
|
||||
select
|
||||
`id`,
|
||||
row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
|
||||
`old_index`,
|
||||
`option_id`,
|
||||
`option_val`,
|
||||
`option_parm`
|
||||
from (
|
||||
select * from (
|
||||
select
|
||||
`id`,
|
||||
0 as `old_index`,
|
||||
`option_id0` as `option_id`,
|
||||
`option_val0` as `option_val`,
|
||||
`option_parm0` as `option_parm`
|
||||
from `${other_storage}`
|
||||
where `option_id0` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
1 as `old_index`,
|
||||
`option_id1` as `option_id`,
|
||||
`option_val1` as `option_val`,
|
||||
`option_parm1` as `option_parm`
|
||||
from `${other_storage}`
|
||||
where `option_id1` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
2 as `old_index`,
|
||||
`option_id2` as `option_id`,
|
||||
`option_val2` as `option_val`,
|
||||
`option_parm2` as `option_parm`
|
||||
from `${other_storage}`
|
||||
where `option_id2` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
3 as `old_index`,
|
||||
`option_id3` as `option_id`,
|
||||
`option_val3` as `option_val`,
|
||||
`option_parm3` as `option_parm`
|
||||
from `${other_storage}`
|
||||
where `option_id3` <> 0
|
||||
union
|
||||
select
|
||||
`id`,
|
||||
4 as `old_index`,
|
||||
`option_id4` as `option_id`,
|
||||
`option_val4` as `option_val`,
|
||||
`option_parm4` as `option_parm`
|
||||
from `${other_storage}`
|
||||
where `option_id4` <> 0
|
||||
) t2
|
||||
order by `id`, `old_index`
|
||||
) t ;
|
||||
|
||||
-- Fix option 0
|
||||
update `${other_storage}`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
|
||||
set
|
||||
`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 1
|
||||
update `${other_storage}`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
|
||||
set
|
||||
`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 2
|
||||
update `${other_storage}`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
|
||||
set
|
||||
`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 3
|
||||
update `${other_storage}`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
|
||||
set
|
||||
`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Fix option 4
|
||||
update `${other_storage}`
|
||||
left join `tmp_randomoptionfix`
|
||||
on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
|
||||
set
|
||||
`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
|
||||
`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
|
||||
`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
|
||||
;
|
||||
|
||||
-- Delete the data to have a clean table for the next run
|
||||
delete from `tmp_randomoptionfix`;
|
||||
**/
|
||||
|
||||
drop table `tmp_randomoptionfix`;
|
||||
20
sql-files/upgrades/upgrade_20221220.sql
Normal file
20
sql-files/upgrades/upgrade_20221220.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
--
|
||||
-- Table structure for table `party_bookings`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `party_bookings` (
|
||||
`world_name` varchar(32) NOT NULL,
|
||||
`account_id` int(11) unsigned NOT NULL,
|
||||
`char_id` int(11) unsigned NOT NULL,
|
||||
`char_name` varchar(23) NOT NULL,
|
||||
`purpose` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`assist` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`damagedealer` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`healer` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`tanker` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`minimum_level` smallint(5) unsigned NOT NULL,
|
||||
`maximum_level` smallint(5) unsigned NOT NULL,
|
||||
`comment` varchar(255) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`world_name`, `account_id`, `char_id`)
|
||||
) ENGINE=MyISAM;
|
||||
Reference in New Issue
Block a user