Util to migrate saccts to server-specific table
This commit is contained in:
@@ -424,4 +424,26 @@ function isDevelopmentServer() {
|
||||
return intToBool(server.getCVar("devserver") || 0);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function migrateSubAccountsToPerServerData() {
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbQuery = false;
|
||||
let dbAssoc = false;
|
||||
if(dbConnection) {
|
||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM sacct_main`);
|
||||
if(dbQuery) {
|
||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
createDefaultSubAccountServerData(dbAssoc["sacct_id"]);
|
||||
|
||||
let dbQuery2 = queryDatabase(dbConnection, `UPDATE sacct_svr SET sacct_svr_skin = ${dbAssoc["sacct_skin"]}, sacct_svr_job = ${dbAssoc["sacct_job"]} WHERE sacct_svr_sacct=${dbAssoc["sacct_id"]} AND sacct_svr_server=${dbAssoc["sacct_server"]}`);
|
||||
if(dbQuery2) {
|
||||
freeDatabaseQuery(dbQuery2);
|
||||
}
|
||||
}
|
||||
freeDatabaseQuery(dbQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user