From 4fb6b49b86d43da51638105817ebbfeb91eea000 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 13 May 2024 08:40:27 +0200 Subject: [PATCH] small fix --- packages/tools/src/structureTools.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/tools/src/structureTools.ts b/packages/tools/src/structureTools.ts index 42b0ffbc..6583d0cd 100644 --- a/packages/tools/src/structureTools.ts +++ b/packages/tools/src/structureTools.ts @@ -2,6 +2,10 @@ import type { DatabaseInfo, TableInfo, ApplicationDefinition, ViewInfo, Collecti import _flatten from 'lodash/flatten'; export function addTableDependencies(db: DatabaseInfo): DatabaseInfo { + if (!db.tables) { + return db; + } + const allForeignKeys = _flatten(db.tables.map(x => x.foreignKeys || [])); return { ...db,