Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
19 lines
692 B
Plaintext
19 lines
692 B
Plaintext
const getTables = (adapter)=>{
|
|
return adapter.client.execute(`SELECT name
|
|
FROM sqlite_master
|
|
WHERE type = 'table'
|
|
AND name NOT LIKE 'sqlite_%';`);
|
|
};
|
|
const dropTables = (adapter, rows)=>{
|
|
const multi = `
|
|
PRAGMA foreign_keys = OFF;\n
|
|
${rows.map(({ name })=>`DROP TABLE IF EXISTS ${name}`).join(';\n ')};\n
|
|
PRAGMA foreign_keys = ON;`;
|
|
return adapter.client.executeMultiple(multi);
|
|
};
|
|
export const dropDatabase = async function({ adapter }) {
|
|
const result = await getTables(adapter);
|
|
await dropTables(adapter, result.rows);
|
|
};
|
|
|
|
//# sourceMappingURL=dropDatabase.js.map |