Files
Paradise/code/modules/unit_tests/sql.dm
AffectedArc07 2bad70717c Async SQL + SSdbcore (#15007)
* Initial Commit - Async SQL

* First batch of queries

* More progress

* Nukes DB Polls

* More work

* oops

* One push

* Notes work now

* Ok these work

* Watchlist done

* Async Bans!

* Async Permissions

* Async client procs

* I officially hate preference datums

* Also these

* Async Custom Items

* Async Karma

* Async Library

* Async TOS

* Cleans out the old SQL code

* CI Sanity

* Apparently MySQL doesnt support this

* What about this

* Maybe this

* Review pass 1

* This too

* Fixes job ban loading

* Fix undeleted queries

* Prevents sensitive queries being logged

* Documentation + tweaks

* Adds a verb to force reconnect the DB

* More review tweaks

* Farie tweaks

* Fixes this
2020-12-16 15:46:25 -05:00

46 lines
1.3 KiB
Plaintext

// Unit test to check SQL version has been updated properly.,
/datum/unit_test/sql_version/Run()
// Check if the SQL version set in the code is equal to the CI DB config
if(config.sql_enabled && sql_version != SQL_VERSION)
Fail("SQL version error: Game is running V[SQL_VERSION] but config is V[sql_version]. You may need to update tools/ci/dbconfig.txt")
// Check if the CI DB config is up to date with the example dbconfig
// This proc is a little unclean but it works
var/example_db_version
var/list/Lines = file2list("config/example/dbconfig.txt")
for(var/t in Lines)
if(!t) continue
t = trim(t)
if(length(t) == 0)
continue
else if(copytext(t, 1, 2) == "#")
continue
var/pos = findtext(t, " ")
var/name = null
var/value = null
if(pos)
name = lowertext(copytext(t, 1, pos))
value = copytext(t, pos + 1)
else
name = lowertext(t)
if(!name)
continue
switch(name)
if("db_version")
example_db_version = text2num(value)
if(!example_db_version)
Fail("SQL version error: File config/example/dbconfig.txt does not have a valid SQL version set!")
if(example_db_version != SQL_VERSION)
Fail("SQL version error: Game is running V[SQL_VERSION] but config/example/dbconfig.txt is V[example_db_version].")
if(SSdbcore.total_errors > 0)
Fail("SQL errors occured on startup. Please fix them.")