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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user