🐛 fix(sql): 根据实际情况进行修正

This commit is contained in:
BTMuli
2023-05-06 02:17:38 +08:00
parent dafc426d41
commit ca4aa179b6
2 changed files with 12 additions and 12 deletions

View File

@@ -143,8 +143,8 @@ async function getBindRoleV2 () {
bindRole.map(async (role: BTMuli.User.Game.Account) => { bindRole.map(async (role: BTMuli.User.Game.Account) => {
const sql = ` const sql = `
INSERT INTO GameAccount (gameBiz, gameUid, isChosen, isOfficial, level, nickname, region, regionName, updated) INSERT INTO GameAccount (gameBiz, gameUid, isChosen, isOfficial, level, nickname, region, regionName, updated)
Values ('${role.game_biz}', '${role.game_uid}', ${role.is_chosen ? 1 : 0}, ${role.is_official ? 1 : 0}, '${role.level}', '${role.nickname}', '${role.region}', '${role.region_name}', datetime('now', 'localtime') VALUES ('${role.game_biz}', '${role.game_uid}', ${role.is_chosen ? 1 : 0}, ${role.is_official ? 1 : 0}, '${role.level}', '${role.nickname}', '${role.region}', '${role.region_name}', datetime('now', 'localtime'))
ON CONFILCT (gameBiz, gameUid) DO UPDATE SET ON CONFLICT (gameBiz, gameUid) DO UPDATE SET
isChosen = ${role.is_chosen ? 1 : 0}, isChosen = ${role.is_chosen ? 1 : 0},
isOfficial = ${role.is_official ? 1 : 0}, isOfficial = ${role.is_official ? 1 : 0},
level = '${role.level}', level = '${role.level}',

View File

@@ -40,16 +40,16 @@ function initGameAccountTable (): string[] {
sqlRes.push(` sqlRes.push(`
CREATE TABLE IF NOT EXISTS GameAccount CREATE TABLE IF NOT EXISTS GameAccount
( (
gameBiz TEXT PRIMARY KEY, gameBiz TEXT NOT NULL,
gameUid TEXT DEFAULT NULL, gameUid TEXT NOT NULL,
isChosen BOOLEAN DEFAULT 0, isChosen BOOLEAN DEFAULT 0,
isOfficial BOOLEAN DEFAULT 0, isOfficial BOOLEAN DEFAULT 0,
level INTEGER DEFAULT 0, level INTEGER DEFAULT 0,
nickname TEXT DEFAULT NULL, nickname TEXT DEFAULT NULL,
region TEXT DEFAULT NULL, region TEXT DEFAULT NULL,
regionName TEXT DEFAULT NULL, regionName TEXT DEFAULT NULL,
updated TEXT DEFAULT NULL, updated TEXT DEFAULT NULL,
PRIMARY KEY (gameBiz, gameUid) PRIMARY KEY (gameBiz, gameUid)
); );
`); `);
return sqlRes; return sqlRes;