summaryrefslogtreecommitdiff
path: root/sql-files/upgrade_svn11548.sql
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-24 12:14:18 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-24 12:14:18 +0000
commit3ecde465534c93315a1f88430129e8400f4d9fe2 (patch)
treefb1153e7be48da7d89b9697be733124650045fdf /sql-files/upgrade_svn11548.sql
parent04580084c4ac2113d06a23fdf2ca4596dd04011b (diff)
downloadhercules-3ecde465534c93315a1f88430129e8400f4d9fe2.tar.gz
hercules-3ecde465534c93315a1f88430129e8400f4d9fe2.tar.bz2
hercules-3ecde465534c93315a1f88430129e8400f4d9fe2.tar.xz
hercules-3ecde465534c93315a1f88430129e8400f4d9fe2.zip
* Cleaned up some messy guild code (more to come)
* Cleaned up the mail code, no more pointless dynamic allocation * Added upgrade_svn11548.sql to convert the mail table to new format * Updated vs7 and vs6 project files * Increased the max. send buffer size to 5M since 1M is not enough * Please complain if something stops working ^^; git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11571 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'sql-files/upgrade_svn11548.sql')
-rw-r--r--sql-files/upgrade_svn11548.sql29
1 files changed, 29 insertions, 0 deletions
diff --git a/sql-files/upgrade_svn11548.sql b/sql-files/upgrade_svn11548.sql
new file mode 100644
index 000000000..722806f12
--- /dev/null
+++ b/sql-files/upgrade_svn11548.sql
@@ -0,0 +1,29 @@
+-- this will covert the old `mail` table to new format, convert columns and fill in default values --
+
+-- change structure --
+ALTER TABLE `mail` CHANGE `message_id` `id` bigint(20) unsigned NOT NULL auto_increment;
+ALTER TABLE `mail` CHANGE `from_char_name` `send_name` varchar(30) NOT NULL default '' AFTER `id`;
+ALTER TABLE `mail` CHANGE `from_account_id` `send_id` int(11) unsigned NOT NULL default 0 AFTER `send_name`;
+ALTER TABLE `mail` CHANGE `to_char_name` `dest_name` varchar(30) NOT NULL default '' AFTER `send_id`;
+ALTER TABLE `mail` CHANGE `to_account_id` `dest_id` int(11) unsigned NOT NULL default 0 AFTER `dest_name`;
+ALTER TABLE `mail` ADD `title` varchar(45) NOT NULL default '' AFTER `dest_id`;
+ALTER TABLE `mail` CHANGE `message` `message` varchar(255) NOT NULL default '' AFTER `title`;
+ALTER TABLE `mail` ADD `time` int(11) unsigned NOT NULL default 0 AFTER `message`;
+ALTER TABLE `mail` CHANGE `read_flag` `read_flag` tinyint(1) NOT NULL default 0 AFTER `time`;
+ALTER TABLE `mail` ADD `zeny` int(11) unsigned NOT NULL default 0 AFTER `read_flag`;
+ALTER TABLE `mail` ADD `nameid` int(11) unsigned NOT NULL default 0 AFTER `zeny`;
+ALTER TABLE `mail` ADD `amount` int(11) unsigned NOT NULL default 0 AFTER `nameid`;
+ALTER TABLE `mail` ADD `refine` tinyint(3) unsigned NOT NULL default 0 AFTER `amount`;
+ALTER TABLE `mail` ADD `attribute` tinyint(4) unsigned NOT NULL default 0 AFTER `refine`;
+ALTER TABLE `mail` ADD `identify` smallint(6) NOT NULL default 0 AFTER `attribute`;
+ALTER TABLE `mail` ADD `card0` smallint(11) NOT NULL default 0 AFTER `identify`;
+ALTER TABLE `mail` ADD `card1` smallint(11) NOT NULL default 0 AFTER `card0`;
+ALTER TABLE `mail` ADD `card2` smallint(11) NOT NULL default 0 AFTER `card1`;
+ALTER TABLE `mail` ADD `card3` smallint(11) NOT NULL default 0 AFTER `card2`;
+ALTER TABLE `mail` DROP `priority`;
+ALTER TABLE `mail` DROP `check_flag`;
+
+-- correct values in some columns --
+UPDATE `mail` SET `time` = UNIX_TIMESTAMP(NOW());
+UPDATE `mail` SET `send_id` = (SELECT `char_id` FROM `char` WHERE `name` = `send_name`);
+UPDATE `mail` SET `dest_id` = (SELECT `char_id` FROM `char` WHERE `name` = `dest_name`);