From 1a6597131ec7bd9e806dfaa380311f1673765306 Mon Sep 17 00:00:00 2001 From: Bara Date: Sat, 4 Mar 2023 03:47:36 +0100 Subject: [PATCH] Drop name and steamid64 columns except from ck_players after importing (version 14) --- .../scripting/surftimer/db/updater.sp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/surftimer/db/updater.sp b/addons/sourcemod/scripting/surftimer/db/updater.sp index 058e25ab..e49f711c 100644 --- a/addons/sourcemod/scripting/surftimer/db/updater.sp +++ b/addons/sourcemod/scripting/surftimer/db/updater.sp @@ -107,7 +107,13 @@ void CheckDatabaseForUpdates() return; } - LogMessage("Version 14 looks good."); + if (!SQL_FastQuery(g_hDb, "SELECT accountid FROM ck_vipadmins LIMIT 1")) + { + db_upgradeDatabase(15, true); + return; + } + + LogMessage("Version 15 looks good."); } } @@ -229,6 +235,16 @@ void db_upgradeDatabase(int ver, bool skipErrorCheck = false) return; } } + else if (ver == 15) + { + SQL_FastQuery(g_hDb, "ALTER TABLE ck_latestrecords MODIFY name VARCHAR(64);"); + SQL_FastQuery(g_hDb, "ALTER TABLE ck_bonus DROP COLUMN name;"); + SQL_FastQuery(g_hDb, "ALTER TABLE ck_latestrecords DROP COLUMN name;"); + SQL_FastQuery(g_hDb, "ALTER TABLE ck_playertimes DROP COLUMN name;"); + SQL_FastQuery(g_hDb, "ALTER TABLE ck_prinfo DROP COLUMN name;"); + SQL_FastQuery(g_hDb, "ALTER TABLE ck_playerrank DROP COLUMN steamid64;"); + SQL_FastQuery(g_hDb, "ALTER TABLE ck_wrcps DROP COLUMN name;"); + } CheckDatabaseForUpdates(); }