Skip to content

Commit

Permalink
handle tables too
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi committed Jan 8, 2025
1 parent 5549151 commit 884769b
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions front/migrations/20250108_backfill_folder_parents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,25 @@ async function migrateNode(
if (node.parents.length === 0) {
logger.info("Node has no parents.");
if (execute) {
await coreAPI.updateDataSourceDocumentParents({
projectId,
dataSourceId,
documentId: node.node_id,
parentId: null,
parents: [node.node_id],
});
if (node.document !== null) {
await coreAPI.updateDataSourceDocumentParents({
projectId,
dataSourceId,
documentId: node.node_id,
parentId: null,
parents: [node.node_id],
});
} else if (node.table !== null) {
await coreAPI.updateTableParents({
projectId,
dataSourceId,
tableId: node.node_id,
parentId: null,
parents: [node.node_id],
});
} else {
logger.warn("Node is neither a document nor a table.");
}
}
} else if (node.parents.length >= 2) {
logger.warn("Node has 2 parents or more.");
Expand Down

0 comments on commit 884769b

Please sign in to comment.