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