mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-09 07:54:14 +00:00
adds more round id tracking
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255.
|
||||
|
||||
The latest database version is 3.2; The query to update the schema revision table is:
|
||||
The latest database version is 3.3; The query to update the schema revision table is:
|
||||
|
||||
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 2);
|
||||
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 3);
|
||||
or
|
||||
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 2);
|
||||
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 3);
|
||||
|
||||
----------------------------------------------------
|
||||
In any query remember to add a prefix to the table names if you use one.
|
||||
----------------------------------------------------
|
||||
|
||||
25 August 2017, by Jordie0608
|
||||
|
||||
Modified tables 'connection_log', 'legacy_population', 'library', 'messages' and 'player' to add additional 'round_id' tracking in various forms and 'server_ip' and 'server_port' to the table 'messages'.
|
||||
|
||||
ALTER TABLE `connection_log` ADD COLUMN `round_id` INT(11) UNSIGNED NOT NULL AFTER `server_port`;
|
||||
ALTER TABLE `legacy_population` ADD COLUMN `round_id` INT(11) UNSIGNED NOT NULL AFTER `server_port`;
|
||||
ALTER TABLE `library` ADD COLUMN `round_id_created` INT(11) UNSIGNED NOT NULL AFTER `deleted`;
|
||||
ALTER TABLE `messages` ADD COLUMN `server_ip` INT(10) UNSIGNED NOT NULL AFTER `server`, ADD COLUMN `server_port` SMALLINT(5) UNSIGNED NOT NULL AFTER `server_ip`, ADD COLUMN `round_id` INT(11) UNSIGNED NOT NULL AFTER `server_port`;
|
||||
ALTER TABLE `player` ADD COLUMN `firstseen_round_id` INT(11) UNSIGNED NOT NULL AFTER `firstseen`, ADD COLUMN `lastseen_round_id` INT(11) UNSIGNED NOT NULL AFTER `lastseen`;
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ CREATE TABLE `connection_log` (
|
||||
`datetime` datetime DEFAULT NULL,
|
||||
`server_ip` int(10) unsigned NOT NULL,
|
||||
`server_port` smallint(5) unsigned NOT NULL,
|
||||
`round_id` int(11) unsigned NOT NULL,
|
||||
`ckey` varchar(45) DEFAULT NULL,
|
||||
`ip` int(10) unsigned NOT NULL,
|
||||
`computerid` varchar(45) DEFAULT NULL,
|
||||
@@ -202,6 +203,7 @@ CREATE TABLE `legacy_population` (
|
||||
`time` datetime NOT NULL,
|
||||
`server_ip` int(10) unsigned NOT NULL,
|
||||
`server_port` smallint(5) unsigned NOT NULL,
|
||||
`round_id` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
@@ -222,6 +224,7 @@ CREATE TABLE `library` (
|
||||
`ckey` varchar(32) NOT NULL DEFAULT 'LEGACY',
|
||||
`datetime` datetime NOT NULL,
|
||||
`deleted` tinyint(1) unsigned DEFAULT NULL,
|
||||
`round_id_created` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `deleted_idx` (`deleted`),
|
||||
KEY `idx_lib_id_del` (`id`,`deleted`),
|
||||
@@ -245,6 +248,9 @@ CREATE TABLE `messages` (
|
||||
`text` varchar(2048) NOT NULL,
|
||||
`timestamp` datetime NOT NULL,
|
||||
`server` varchar(32) DEFAULT NULL,
|
||||
`server_ip` int(10) unsigned NOT NULL,
|
||||
`server_port` smallint(5) unsigned NOT NULL,
|
||||
`round_id` int(11) unsigned NOT NULL,
|
||||
`secret` tinyint(1) unsigned NOT NULL,
|
||||
`lasteditor` varchar(32) DEFAULT NULL,
|
||||
`edits` text,
|
||||
@@ -280,7 +286,9 @@ DROP TABLE IF EXISTS `player`;
|
||||
CREATE TABLE `player` (
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
`firstseen` datetime NOT NULL,
|
||||
`firstseen_round_id` int(11) unsigned NOT NULL,
|
||||
`lastseen` datetime NOT NULL,
|
||||
`lastseen_round_id` int(11) unsigned NOT NULL,
|
||||
`ip` int(10) unsigned NOT NULL,
|
||||
`computerid` varchar(32) NOT NULL,
|
||||
`lastadminrank` varchar(32) NOT NULL DEFAULT 'Player',
|
||||
|
||||
@@ -110,6 +110,7 @@ CREATE TABLE `SS13_connection_log` (
|
||||
`datetime` datetime DEFAULT NULL,
|
||||
`server_ip` int(10) unsigned NOT NULL,
|
||||
`server_port` smallint(5) unsigned NOT NULL,
|
||||
`round_id` int(11) unsigned NOT NULL,
|
||||
`ckey` varchar(45) DEFAULT NULL,
|
||||
`ip` int(10) unsigned NOT NULL,
|
||||
`computerid` varchar(45) DEFAULT NULL,
|
||||
@@ -202,6 +203,7 @@ CREATE TABLE `SS13_legacy_population` (
|
||||
`time` datetime NOT NULL,
|
||||
`server_ip` int(10) unsigned NOT NULL,
|
||||
`server_port` smallint(5) unsigned NOT NULL,
|
||||
`round_id` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
@@ -222,6 +224,7 @@ CREATE TABLE `SS13_library` (
|
||||
`ckey` varchar(32) NOT NULL DEFAULT 'LEGACY',
|
||||
`datetime` datetime NOT NULL,
|
||||
`deleted` tinyint(1) unsigned DEFAULT NULL,
|
||||
`round_id_created` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `deleted_idx` (`deleted`),
|
||||
KEY `idx_lib_id_del` (`id`,`deleted`),
|
||||
@@ -245,6 +248,9 @@ CREATE TABLE `SS13_messages` (
|
||||
`text` varchar(2048) NOT NULL,
|
||||
`timestamp` datetime NOT NULL,
|
||||
`server` varchar(32) DEFAULT NULL,
|
||||
`server_ip` int(10) unsigned NOT NULL,
|
||||
`server_port` smallint(5) unsigned NOT NULL,
|
||||
`round_id` int(11) unsigned NOT NULL,
|
||||
`secret` tinyint(1) unsigned NOT NULL,
|
||||
`lasteditor` varchar(32) DEFAULT NULL,
|
||||
`edits` text,
|
||||
@@ -280,7 +286,9 @@ DROP TABLE IF EXISTS `SS13_player`;
|
||||
CREATE TABLE `SS13_player` (
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
`firstseen` datetime NOT NULL,
|
||||
`firstseen_round_id` int(11) unsigned NOT NULL,
|
||||
`lastseen` datetime NOT NULL,
|
||||
`lastseen_round_id` int(11) unsigned NOT NULL,
|
||||
`ip` int(10) unsigned NOT NULL,
|
||||
`computerid` varchar(32) NOT NULL,
|
||||
`lastadminrank` varchar(32) NOT NULL DEFAULT 'Player',
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
#error You need version 511 or higher
|
||||
#endif
|
||||
|
||||
//Update this whenever the db schema changes
|
||||
//Update this whenever the db schema changes
|
||||
//make sure you add an update to the schema_version stable in the db changelog
|
||||
#define DB_MAJOR_VERSION 3
|
||||
#define DB_MINOR_VERSION 2
|
||||
#define DB_MINOR_VERSION 3
|
||||
|
||||
@@ -35,7 +35,7 @@ SUBSYSTEM_DEF(blackbox)
|
||||
if(M.client)
|
||||
playercount += 1
|
||||
var/admincount = GLOB.admins.len
|
||||
var/datum/DBQuery/query_record_playercount = SSdbcore.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]')")
|
||||
var/datum/DBQuery/query_record_playercount = SSdbcore.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port, round_id) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', '[GLOB.round_id]')")
|
||||
query_record_playercount.Execute()
|
||||
|
||||
if(config.use_exp_tracking)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
secret = 0
|
||||
else
|
||||
return
|
||||
var/datum/DBQuery/query_create_message = SSdbcore.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, secret) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', '[secret]')")
|
||||
var/datum/DBQuery/query_create_message = SSdbcore.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, server_ip, server_port, round_id, secret) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', '[GLOB.round_id]','[secret]')")
|
||||
if(!query_create_message.warn_execute())
|
||||
return
|
||||
if(logged)
|
||||
|
||||
@@ -353,7 +353,7 @@ GLOBAL_LIST(external_rsc_urls)
|
||||
|
||||
/client/Del()
|
||||
if(credits)
|
||||
QDEL_LIST(credits)
|
||||
QDEL_LIST(credits)
|
||||
log_access("Logout: [key_name(src)]")
|
||||
if(holder)
|
||||
adminGreet(1)
|
||||
@@ -434,7 +434,7 @@ GLOBAL_LIST(external_rsc_urls)
|
||||
|
||||
new_player = 1
|
||||
account_join_date = sanitizeSQL(findJoinDate())
|
||||
var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `firstseen`, `lastseen`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', Now(), Now(), INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])")
|
||||
var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `firstseen`, `firstseen_round_id`, `lastseen`, `lastseen_round_id`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', Now(), '[GLOB.round_id]', Now(), '[GLOB.round_id]', INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])")
|
||||
if(!query_add_player.Execute())
|
||||
return
|
||||
if(!account_join_date)
|
||||
@@ -460,12 +460,12 @@ GLOBAL_LIST(external_rsc_urls)
|
||||
if(query_datediff.NextRow())
|
||||
account_age = text2num(query_datediff.item[1])
|
||||
if(!new_player)
|
||||
var/datum/DBQuery/query_log_player = SSdbcore.NewQuery("UPDATE [format_table_name("player")] SET lastseen = Now(), ip = INET_ATON('[sql_ip]'), computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]', accountjoindate = [account_join_date ? "'[account_join_date]'" : "NULL"] WHERE ckey = '[sql_ckey]'")
|
||||
var/datum/DBQuery/query_log_player = SSdbcore.NewQuery("UPDATE [format_table_name("player")] SET lastseen = Now(), lastseen_round_id = '[GLOB.round_id]', ip = INET_ATON('[sql_ip]'), computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]', accountjoindate = [account_join_date ? "'[account_join_date]'" : "NULL"] WHERE ckey = '[sql_ckey]'")
|
||||
if(!query_log_player.Execute())
|
||||
return
|
||||
if(!account_join_date)
|
||||
account_join_date = "Error"
|
||||
var/datum/DBQuery/query_log_connection = SSdbcore.NewQuery("INSERT INTO `[format_table_name("connection_log")]` (`id`,`datetime`,`server_ip`,`server_port`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')),'[world.port]','[sql_ckey]',INET_ATON('[sql_ip]'),'[sql_computerid]')")
|
||||
var/datum/DBQuery/query_log_connection = SSdbcore.NewQuery("INSERT INTO `[format_table_name("connection_log")]` (`id`,`datetime`,`server_ip`,`server_port`,`round_id`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')),'[world.port]','[GLOB.round_id]','[sql_ckey]',INET_ATON('[sql_ip]'),'[sql_computerid]')")
|
||||
query_log_connection.Execute()
|
||||
if(new_player)
|
||||
player_age = -1
|
||||
|
||||
@@ -419,7 +419,7 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums
|
||||
var/sqlauthor = sanitizeSQL(scanner.cache.author)
|
||||
var/sqlcontent = sanitizeSQL(scanner.cache.dat)
|
||||
var/sqlcategory = sanitizeSQL(upload_category)
|
||||
var/datum/DBQuery/query_library_upload = SSdbcore.NewQuery("INSERT INTO [format_table_name("library")] (author, title, content, category, ckey, datetime) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', '[usr.ckey]', Now())")
|
||||
var/datum/DBQuery/query_library_upload = SSdbcore.NewQuery("INSERT INTO [format_table_name("library")] (author, title, content, category, ckey, datetime, round_id_created) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', '[usr.ckey]', Now(), '[GLOB.round_id]')")
|
||||
if(!query_library_upload.Execute())
|
||||
alert("Database error encountered uploading to Archive")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user