mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Fix sqlite migrations for preferences.
This commit is contained in:
@@ -3,11 +3,11 @@
|
|||||||
name = "Add Progress Bars"
|
name = "Add Progress Bars"
|
||||||
|
|
||||||
/datum/migration/sqlite/ss13_prefs/_002/up()
|
/datum/migration/sqlite/ss13_prefs/_002/up()
|
||||||
if(!hasColumn("progress_bars"))
|
if(!hasColumn("client","progress_bars"))
|
||||||
return execute("ALTER TABLE `client` ADD COLUMN progress_bars INTEGER DEFAULT 1")
|
return execute("ALTER TABLE `client` ADD COLUMN progress_bars INTEGER DEFAULT 1")
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/datum/migration/sqlite/ss13_prefs/_002/down()
|
/datum/migration/sqlite/ss13_prefs/_002/down()
|
||||||
if(hasColumn("progress_bars"))
|
if(hasColumn("client","progress_bars"))
|
||||||
return execute("ALTER TABLE `client` DROP COLUMN progress_bars")
|
return execute("ALTER TABLE `client` DROP COLUMN progress_bars")
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ CREATE TABLE IF NOT EXISTS [TABLE_NAME] (
|
|||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
/datum/migration_controller/sqlite/hasTable(var/tableName)
|
/datum/migration_controller/sqlite/hasTable(var/tableName)
|
||||||
return hasResult("SELECT name FROM sqlite_master WHERE type='[tableName]'")
|
var/exists = hasResult("SELECT name FROM sqlite_master WHERE type='table' AND name='[tableName]';")
|
||||||
|
return exists
|
||||||
|
|
||||||
#ifdef DEBUG_SQLITE_MIGCON
|
#ifdef DEBUG_SQLITE_MIGCON
|
||||||
#undef _DEBUG
|
#undef _DEBUG
|
||||||
|
|||||||
@@ -40,7 +40,8 @@
|
|||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/datum/migration/sqlite/hasTable(var/tableName)
|
/datum/migration/sqlite/hasTable(var/tableName)
|
||||||
return hasResult("SELECT name FROM sqlite_master WHERE type='[tableName]'")
|
var/exists = hasResult("SELECT name FROM sqlite_master WHERE type='table' AND name='[tableName]';")
|
||||||
|
return exists
|
||||||
|
|
||||||
/datum/migration/sqlite/hasColumn(var/tableName, var/columnName)
|
/datum/migration/sqlite/hasColumn(var/tableName, var/columnName)
|
||||||
for(var/list/row in query("PRAGMA table_info([tableName])")) // Can't be turned into a SELECT.
|
for(var/list/row in query("PRAGMA table_info([tableName])")) // Can't be turned into a SELECT.
|
||||||
|
|||||||
Reference in New Issue
Block a user