Skip to content

Commit

Permalink
Fixed nullpointer exsception in the case when table doesn't have uniq…
Browse files Browse the repository at this point in the history
…ue constraints
  • Loading branch information
AdalbertMemSQL committed Aug 19, 2024
1 parent e53801a commit dc24a9b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions generate-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit dc24a9b

Please sign in to comment.