Initialize native mode schema synchronously before reading it
Core tests / core (push) Successful in 2m7s

This commit is contained in:
Codex
2026-09-24 05:35:53 +12:00
parent 64e2796a74
commit 6b8ce612ad
2 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -2,8 +2,9 @@
-- from its factory-created, unused starting-level reserve; identities are never reset. -- from its factory-created, unused starting-level reserve; identities are never reset.
-- Install only after deploy/playable/install-lifecycle.py has seeded the registry. -- Install only after deploy/playable/install-lifecycle.py has seeded the registry.
-- The persisted mode is synchronized from dashboard settings by operations-agent. -- The persisted mode is synchronized from dashboard settings by operations-agent.
AuthDBExecute("CREATE TABLE IF NOT EXISTS azerothai_realm_rules (id TINYINT PRIMARY KEY,hardcore TINYINT NOT NULL)") -- Schema setup must finish before the first synchronous mode read.
AuthDBExecute("INSERT IGNORE INTO azerothai_realm_rules VALUES (1,1)") AuthDBQuery("CREATE TABLE IF NOT EXISTS azerothai_realm_rules (id TINYINT PRIMARY KEY,hardcore TINYINT NOT NULL)")
AuthDBQuery("INSERT IGNORE INTO azerothai_realm_rules VALUES (1,1)")
function AzerothAIHardcoreEnabled() function AzerothAIHardcoreEnabled()
local q=AuthDBQuery("SELECT hardcore FROM azerothai_realm_rules WHERE id=1") local q=AuthDBQuery("SELECT hardcore FROM azerothai_realm_rules WHERE id=1")
return not q or q:GetUInt32(0)~=0 return not q or q:GetUInt32(0)~=0
+3 -1
View File
@@ -20,7 +20,9 @@ function player(guid,name,account,level,dead)
players[name]=p; return p players[name]=p; return p
end end
function AuthDBQuery(sql) function AuthDBQuery(sql)
if string.find(sql,"azerothai_realm_rules",1,true) then return {GetUInt32=function()return mode or 1 end} end if string.find(sql,"CREATE TABLE IF NOT EXISTS azerothai_realm_rules",1,true) then rulesReady=true;return nil end
if string.find(sql,"INSERT IGNORE INTO azerothai_realm_rules",1,true) then assert(rulesReady);return nil end
if string.find(sql,"SELECT hardcore FROM azerothai_realm_rules",1,true) then assert(rulesReady,'Schema must exist before synchronous mode reads');return {GetUInt32=function()return mode or 1 end} end
if string.find(sql,'SELECT id FROM account',1,true) then if string.find(sql,'SELECT id FROM account',1,true) then
if string.find(sql,'id=99 ',1,true) then return nil end if string.find(sql,'id=99 ',1,true) then return nil end
return {GetUInt32=function() return 2 end} return {GetUInt32=function() return 2 end}