🐛 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) => {
const sql = `
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')
ON CONFILCT (gameBiz, gameUid) DO UPDATE SET
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 CONFLICT (gameBiz, gameUid) DO UPDATE SET
isChosen = ${role.is_chosen ? 1 : 0},
isOfficial = ${role.is_official ? 1 : 0},
level = '${role.level}',

View File

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