u
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
);
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user