From 25c6ddd6318f77672341f5670e7896dea518ebd7 Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 2 Jul 2015 20:07:09 -0700 Subject: [PATCH] Scary final SQL stuff for aa branch --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + .../sql/git/required/2015_07_02_aa_rework.sql | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/common/version.h b/common/version.h index 1813f77c3..00f74e801 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9083 +#define CURRENT_BINARY_DATABASE_VERSION 9084 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index e7aa46221..1a67e2893 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -337,6 +337,7 @@ 9081|2015_05_23_dbstr_us.sql|SHOW TABLES LIKE 'db_str'|empty| 9082|2015_05_25_npc_types_texture_fields.sql|SHOW COLUMNS FROM `npc_types` LIKE 'armtexture'|empty| 9083|2015_06_07_aa_update.sql|SHOW COLUMNS FROM `character_alternate_abilities` LIKE 'charges'|empty| +9084|2015_07_92_aa_rework.sql|SHOW TABLES LIKE 'aa_ranks'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2015_07_02_aa_rework.sql b/utils/sql/git/required/2015_07_02_aa_rework.sql index 41a67f7c0..8a585113c 100644 --- a/utils/sql/git/required/2015_07_02_aa_rework.sql +++ b/utils/sql/git/required/2015_07_02_aa_rework.sql @@ -20649,6 +20649,7 @@ INSERT INTO `aa_rank_prereqs` (`rank_id`, `aa_id`, `points`) VALUES (17533, 677, 1), (17549, 8700, 1); +RENAME TABLE `character_alternate_abilities` TO `character_alternate_abilities_old`; DROP TABLE IF EXISTS `character_alternate_abilities`; CREATE TABLE IF NOT EXISTS `character_alternate_abilities` ( `id` int(11) unsigned NOT NULL DEFAULT '0', @@ -20657,3 +20658,22 @@ CREATE TABLE IF NOT EXISTS `character_alternate_abilities` ( `charges` smallint(11) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`,`aa_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +ALTER TABLE `character_data` ADD COLUMN `aa_points_spent_old` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `aa_points_spent`; +ALTER TABLE `character_data` ADD COLUMN `aa_points_old` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `aa_points`; + +UPDATE `character_data` SET `aa_points_spent_old` = `aa_points_spent`, `aa_points_old` = `aa_points`; + + -- sanity checks since if someone never logged in after the db conversion there is junk data + -- I don't have a good way of addressing this so I keep the old data in aa_points_spent_old and aa_points_old and character_alternate_abilities_old + -- for anyone who wants to personally polish up their player data +UPDATE `character_data` SET `aa_points_spent` = 2700 WHERE `aa_points_spent` > 2700; +UPDATE `character_data` SET `aa_points` = 5000 WHERE `aa_points` > 5000; + + -- another sanity check, give people a few levels below 51 to keep their points +UPDATE `character_data` SET `aa_points_spent` = 0 WHERE `level` < 48; +UPDATE `character_data` SET `aa_points` = 0 WHERE `level` < 48; + + -- aa refund here +UPDATE `character_data` SET `aa_points` = `aa_points_spent` + `aa_points`; +UPDATE `character_data` SET `aa_points_spent` = 0;