fix count cmd for migration
This commit is contained in:
parent
9632e32128
commit
61777c837b
@ -251,18 +251,16 @@ async function migrateTable(tableName, migrateRowFunc) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Check table exists
|
// Check table exists
|
||||||
const exists =
|
const { count } = await db.get(
|
||||||
(await db.get(
|
`SELECT COUNT(*) as count FROM sqlite_master WHERE name='${tableName}'`
|
||||||
`SELECT COUNT(*) FROM sqlite_master WHERE name='${tableName}'`
|
)
|
||||||
)) > 0;
|
if (count === 0) {
|
||||||
if (!exists) {
|
|
||||||
console.log(
|
console.log(
|
||||||
`${tableName} does not exist in legacy DB - nothing to migrate - skipping.`
|
`${tableName} does not exist in legacy DB - nothing to migrate - skipping.`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const upserts = [];
|
const upserts = [];
|
||||||
const rows = await db.all(`SELECT * FROM ${tableName}`);
|
const rows = await db.all(`SELECT * FROM ${tableName}`);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user