Skip to content

Commit

Permalink
PR feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenh committed May 29, 2024
1 parent ce215c6 commit 2f4ad35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/codegen/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function main() {

await writeAlterTables(nonDeferredFks);

if (setting === "error") hasError ??= true;
if (setting === "error") hasError = true;
} else if (setting === "ignore") {
// We trust the user to know what they're doing
}
Expand Down
6 changes: 3 additions & 3 deletions packages/codegen/src/sortForeignKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ export function sortByNonDeferredForeignKeys(entities: EntityDbMetadata[]): {
// Then add nullable deps next, as they can be fixed-up

const nullableCycles: string[] = [];
const notNullCylces: string[] = [];
const notNullCycles: string[] = [];

// If we see `books.author_id`, mark `author.inDegree++`
entities.forEach((entity) => {
entity.nonDeferredFks
.filter((m2o) => m2o.notNull)
.forEach((m2o) => {
const added = addDependency(graph, entity, m2o);
if (Array.isArray(added)) notNullCylces.push(added.join(" -> "));
if (Array.isArray(added)) notNullCycles.push(added.join(" -> "));
});
});

Expand Down Expand Up @@ -93,7 +93,7 @@ export function sortByNonDeferredForeignKeys(entities: EntityDbMetadata[]): {
// Use a marker value for "cyclic"
entities.filter((e) => e.nonDeferredFkOrder === -1).forEach((e) => (e.nonDeferredFkOrder = 100_000));

return { nullableCycles, notNullCycles: notNullCylces };
return { nullableCycles, notNullCycles: notNullCycles };
}

type Node = {
Expand Down

0 comments on commit 2f4ad35

Please sign in to comment.