1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-02 01:19:31 +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(); const tables = Object.keys(data).reverse();
tables.push('sessions'); tables.push('sessions');
for (const table of tables) for (const table of tables) {
/* eslint-disable-next-line no-await-in-loop */ try {
await conn.runQuery(`DELETE FROM ${table};`); /* eslint-disable-next-line no-await-in-loop */
await conn.runQuery(`DELETE FROM ${table};`);
} catch (e) {
if (table !== 'sessions')
throw e;
}
}
conn.close(); conn.close();
} }