1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 22:39:26 +00:00

Fix bug when reinstalling the database where sessions table doesn't exist yet

This commit is contained in:
2022-04-21 13:11:18 +00:00
parent d2d1261bf1
commit 4b9a726cdf

View File

@@ -26,9 +26,15 @@ async function cleanDb() {
const tables = Object.keys(data).reverse();
tables.push('sessions');
for (const table of tables)
/* eslint-disable-next-line no-await-in-loop */
await conn.runQuery(`DELETE FROM ${table};`);
for (const table of tables) {
try {
/* eslint-disable-next-line no-await-in-loop */
await conn.runQuery(`DELETE FROM ${table};`);
} catch (e) {
if (table !== 'sessions')
throw e;
}
}
conn.close();
}