From dc24a9ba5f0e565387d616c5222940120d49aee8 Mon Sep 17 00:00:00 2001 From: Adalbert Makarovych Date: Mon, 19 Aug 2024 13:37:39 +0300 Subject: [PATCH] Fixed nullpointer exsception in the case when table doesn't have unique constraints --- generate-config.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generate-config.ts b/generate-config.ts index a4f7c84..92c6af1 100644 --- a/generate-config.ts +++ b/generate-config.ts @@ -82,9 +82,11 @@ async function main() { const configuration: Configuration = { tables: tables[0].map(table => { const constraints: { [k: string]: UniquenessConstraint } = {}; - (table["UNIQUE_CONSTRAINTS"] as UniqueKey[]).forEach(key => { - constraints[key.name] = { unique_columns: key.columns } - }) + if (table["UNIQUE_CONSTRAINTS"]) { + (table["UNIQUE_CONSTRAINTS"] as UniqueKey[]).forEach(key => { + constraints[key.name] = { unique_columns: key.columns } + }) + } return { tableName: table["TABLE_NAME"],