u
This commit is contained in:
@@ -360,6 +360,11 @@ export class MssqlProvider {
|
||||
BEGIN
|
||||
ALTER TABLE customergroup ADD updated_at DATETIME2 NOT NULL CONSTRAINT DF_customergroup_updated_at DEFAULT SYSUTCDATETIME();
|
||||
END
|
||||
|
||||
IF OBJECT_ID(N'dbo.printeragent', N'U') IS NOT NULL AND COL_LENGTH('printeragent', 'sort') IS NULL
|
||||
BEGIN
|
||||
ALTER TABLE printeragent ADD sort INT NOT NULL CONSTRAINT DF_printeragent_sort DEFAULT 0;
|
||||
END
|
||||
`);
|
||||
} catch {
|
||||
// ignore
|
||||
|
||||
@@ -9,5 +9,12 @@ export default async function upgrade({ query, assertVersion, setVersion }) {
|
||||
|
||||
await query(INIT_PRINTERAGENT);
|
||||
|
||||
await query(`
|
||||
IF OBJECT_ID(N'dbo.printeragent', N'U') IS NOT NULL AND COL_LENGTH('printeragent', 'sort') IS NULL
|
||||
BEGIN
|
||||
ALTER TABLE printeragent ADD sort INT NOT NULL CONSTRAINT DF_printeragent_sort DEFAULT 0;
|
||||
END
|
||||
`);
|
||||
|
||||
await setVersion(3);
|
||||
}
|
||||
|
||||
@@ -438,6 +438,11 @@ export class BetterSqlite3Provider extends BetterSqlite3Executor {
|
||||
this.db.exec(`ALTER TABLE customergroup ADD COLUMN updated_at TEXT`);
|
||||
this.db.exec(`UPDATE customergroup SET updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now') WHERE updated_at IS NULL`);
|
||||
}
|
||||
|
||||
const printeragentCols = this.db.pragma('table_info("printeragent")').map((c) => c.name);
|
||||
if (printeragentCols.length > 0 && !printeragentCols.includes('sort')) {
|
||||
this.db.exec(`ALTER TABLE printeragent ADD COLUMN sort INTEGER NOT NULL DEFAULT 0`);
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user