Skip to content
Snippets Groups Projects
Commit 61777c83 authored by timothycarambat's avatar timothycarambat
Browse files

fix count cmd for migration

parent 9632e321
No related branches found
No related tags found
No related merge requests found
......@@ -251,18 +251,16 @@ async function migrateTable(tableName, migrateRowFunc) {
});
// Check table exists
const exists =
(await db.get(
`SELECT COUNT(*) FROM sqlite_master WHERE name='${tableName}'`
)) > 0;
if (!exists) {
const { count } = await db.get(
`SELECT COUNT(*) as count FROM sqlite_master WHERE name='${tableName}'`
)
if (count === 0) {
console.log(
`${tableName} does not exist in legacy DB - nothing to migrate - skipping.`
);
return;
}
const upserts = [];
const rows = await db.all(`SELECT * FROM ${tableName}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment