change versioning check to use insert

This commit is contained in:
Jordie0608
2017-07-25 17:56:48 +10:00
parent b188a18482
commit 7e6ed58148
2 changed files with 13 additions and 13 deletions

View File

@@ -1,10 +1,10 @@
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.1; The query to update the schema revision table is:
The latest database version is 3.0; The query to update the schema revision table is:
UPDATE `schema_revision` SET major = 3, minor = 1 LIMIT 1;
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 0);
or
UPDATE `SS13_schema_revision` SET major = 3, minor = 1 LIMIT 1;
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 0);
----------------------------------------------------

View File

@@ -59,16 +59,16 @@
if(config.sql_enabled)
if(SSdbcore.Connect())
log_world("Database connection established.")
var/datum/DBQuery/db_version = SSdbcore.NewQuery("SELECT major, minor FROM [format_table_name("schema_version")]")
db_version.Execute()
if(db_version.NextRow())
var/db_major = db_version.item[1]
var/db_minor = db_version.item[2]
var/datum/DBQuery/query_db_version = SSdbcore.NewQuery("SELECT major, minor FROM [format_table_name("schema_version")] ORDER BY date DESC LIMIT 1")
query_db_version.Execute()
if(query_db_version.NextRow())
var/db_major = query_db_version.item[1]
var/db_minor = query_db_version.item[2]
if(db_major < DB_MAJOR_VERSION || db_minor < DB_MINOR_VERSION)
message_admins("db schema ([db_major].[db_minor]) is behind latest tg schema version ([DB_MAJOR_VERSION].[DB_MINOR_VERSION]), this may lead to undefined behaviour or errors")
log_sql("db schema ([db_major].[db_minor]) is behind latest tg schema version ([DB_MAJOR_VERSION].[DB_MINOR_VERSION]), this may lead to undefined behaviour or errors")
message_admins("Database schema ([db_major].[db_minor]) is behind latest schema version ([DB_MAJOR_VERSION].[DB_MINOR_VERSION]), this may lead to undefined behaviour or errors")
log_sql("Database schema ([db_major].[db_minor]) is behind latest schema version ([DB_MAJOR_VERSION].[DB_MINOR_VERSION]), this may lead to undefined behaviour or errors")
else
message_admins("Could not get schema version from db")
message_admins("Could not get schema version from database")
else
log_world("Your server failed to establish a connection with the database.")
@@ -105,10 +105,10 @@
/world/Topic(T, addr, master, key)
var/list/input = params2list(T)
var/pinging = ("ping" in input)
var/playing = ("players" in input)
if(!pinging && !playing && config && config.log_world_topic)
GLOB.world_game_log << "TOPIC: \"[T]\", from:[addr], master:[master], key:[key]"