This commit is contained in:
seb
2026-09-29 17:29:13 +02:00
parent ae5d5cc6f8
commit 30820ba8c7
14 changed files with 69 additions and 36 deletions

View File

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

View File

@@ -627,6 +627,7 @@ CREATE TABLE IF NOT EXISTS propertyname (
company_id INTEGER NOT NULL,
name TEXT NOT NULL,
sort INTEGER NOT NULL DEFAULT 0,
exclusive INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE,
UNIQUE (company_id, name)
);
@@ -640,8 +641,7 @@ CREATE TABLE IF NOT EXISTS articleproperty (
value TEXT NOT NULL,
sort INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (article_id) REFERENCES article(id) ON DELETE CASCADE,
FOREIGN KEY (property_id) REFERENCES propertyname(id) ON DELETE CASCADE,
UNIQUE (article_id, property_id)
FOREIGN KEY (property_id) REFERENCES propertyname(id) ON DELETE CASCADE
);
`;