sqlite multi-statement upgrade fix

This commit is contained in:
Essem 2022-10-25 15:38:20 -05:00
parent 5d679dbb7a
commit a67c2b9884
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
1 changed files with 3 additions and 1 deletions

View File

@ -54,7 +54,9 @@ export async function upgrade(logger) {
while (version < (sqliteUpdates.length - 1)) {
version++;
logger.warn(`Running version ${version} update script (${sqliteUpdates[version]})...`);
connection.prepare(sqliteUpdates[version]).run();
for (const statement of sqliteUpdates[version].split("\n")) {
connection.prepare(statement).run();
}
}
connection.pragma(`user_version = ${version}`); // insecure, but the normal templating method doesn't seem to work here
connection.prepare("COMMIT").run();