This commit is contained in:
seb
2026-09-29 11:21:57 +02:00
parent 5d2c8fdfed
commit 7bb674d5e7
10 changed files with 123 additions and 7 deletions

View File

@@ -413,6 +413,14 @@ export class BetterSqlite3Provider extends BetterSqlite3Executor {
`ALTER TABLE warehouse ADD COLUMN sort INTEGER NOT NULL DEFAULT 0`,
);
}
const posterminalCols = this.db.pragma('table_info("posterminal")').map((c) => c.name);
if (posterminalCols.length > 0 && !posterminalCols.includes('paired_at')) {
this.db.exec(`ALTER TABLE posterminal ADD COLUMN paired_at TEXT`);
}
if (posterminalCols.length > 0 && !posterminalCols.includes('clientserial')) {
this.db.exec(`ALTER TABLE posterminal ADD COLUMN clientserial TEXT`);
}
} catch {
// ignore
}

View File

@@ -5,6 +5,7 @@ const queries = translateQueries(source, 'posterminal');
export const {
CREATE, DELETE_BY_COMPANY_AND_ID, GET_BY_ID, LIST_BY_COMPANY,
LIST_CATEGORY_IDS, POSTERMINAL_IDS_BY_COMPANY, SET_OFF, SET_OFF_ALL, UPDATE,
FIND_BY_PAIRINGPIN, PAIR,
} = queries;
export const SET_ON = `

View File

@@ -533,6 +533,8 @@ CREATE TABLE IF NOT EXISTS posterminal (
name TEXT NOT NULL,
token TEXT,
pairingpin TEXT NOT NULL,
paired_at TEXT,
clientserial TEXT,
FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE
);
CREATE UNIQUE INDEX IF NOT EXISTS UQ_posterminal_token