INNER CODE UNIT · JavaScript
initLogTable
currycan/HaTickets · desktop/src/sql/index.js:60
export const initLogTable = async () => {
await initDb();
await db.execute(
`CREATE TABLE IF NOT EXISTS ${logTableName} (id INTEGER PRIMARY KEY AUTOINCREMENT, time TIMESTAMP NOT NULL, type TEXT, status INTEGER, title TEXT, msg TEXT);`
);
// Add index on time for query performance
await db.execute(
`CREATE INDEX IF NOT EXISTS idx_${logTableName}_time ON ${logTableName} (time);`
);
};
// 初始化 设置表
export const initSettingTable = async () => {
await initDb();
await db.execute(
`CREATE TABLE IF NOT EXISTS ${settingTableName} (proxy TEXT, appid_list TEXT, appid TEXT NOT NULL)`
);
};