summaryrefslogtreecommitdiff
path: root/src/sql/mysql/updates
diff options
context:
space:
mode:
authorAndreas Habel <mail@exceptionfault.de>2008-12-01 18:27:14 +0100
committerAndreas Habel <mail@exceptionfault.de>2008-12-01 18:27:14 +0100
commitb3d6d3889390843374fe0b9184dd77c5fcb84e8b (patch)
tree1601f16d933b8c77b2021b44d659de5a23fd8f3f /src/sql/mysql/updates
parent82b412fa1d77c50689327d949029ff7f5d45fb6b (diff)
downloadmanaserv-b3d6d3889390843374fe0b9184dd77c5fcb84e8b.tar.gz
manaserv-b3d6d3889390843374fe0b9184dd77c5fcb84e8b.tar.bz2
manaserv-b3d6d3889390843374fe0b9184dd77c5fcb84e8b.tar.xz
manaserv-b3d6d3889390843374fe0b9184dd77c5fcb84e8b.zip
Added new table to store online users. See mantis #553
This upgrade will be the first, we provide database installation scripts and update scripts to upgrade from the previous version. For more details about database upgrades see http://wiki.themanaworld.org/index.php/Upgrade_Database and feel free to comment.
Diffstat (limited to 'src/sql/mysql/updates')
-rw-r--r--src/sql/mysql/updates/update_1_to_2.sql33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/sql/mysql/updates/update_1_to_2.sql b/src/sql/mysql/updates/update_1_to_2.sql
new file mode 100644
index 00000000..76ba63df
--- /dev/null
+++ b/src/sql/mysql/updates/update_1_to_2.sql
@@ -0,0 +1,33 @@
+
+-- add table tmw_online_list to store online users
+CREATE TABLE IF NOT EXISTS `tmw_online_list` (
+ `char_id` int(10) unsigned NOT NULL,
+ `login_date` int(10) NOT NULL,
+ --
+ PRIMARY KEY (`char_id`),
+ FOREIGN KEY (`char_id`)
+ REFERENCES `tmw_characters` (`id`)
+ ON DELETE CASCADE
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8 ;
+
+-- create a view to show more details about online users
+CREATE VIEW tmw_v_online_chars
+AS
+ SELECT l.char_id as char_id,
+ l.login_date as login_date,
+ c.user_id as user_id,
+ c.name as name,
+ c.gender as gender,
+ c.level as level,
+ c.map_id as map_id
+ FROM tmw_online_list l
+ JOIN tmw_characters c
+ ON l.char_id = c.id;
+
+-- update the database version, and set date of update
+UPDATE tmw_world_states
+ SET value = '2',
+ moddate = UNIX_TIMESTAMP()
+ WHERE state_name = 'database_version';
+ \ No newline at end of file