mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-03-15 22:52:23 +00:00
check table for migration
This commit is contained in:
parent
a126b5f5aa
commit
9632e32128
1 changed files with 14 additions and 0 deletions
|
@ -249,6 +249,20 @@ async function migrateTable(tableName, migrateRowFunc) {
|
|||
filename: BACKUP_PATH,
|
||||
driver: sqlite3.Database,
|
||||
});
|
||||
|
||||
// Check table exists
|
||||
const exists =
|
||||
(await db.get(
|
||||
`SELECT COUNT(*) FROM sqlite_master WHERE name='${tableName}'`
|
||||
)) > 0;
|
||||
if (!exists) {
|
||||
console.log(
|
||||
`${tableName} does not exist in legacy DB - nothing to migrate - skipping.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const upserts = [];
|
||||
const rows = await db.all(`SELECT * FROM ${tableName}`);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue