-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support schemas with non-deferred FKs. #1100
Conversation
74ff45e
to
0e21cf4
Compare
0e21cf4
to
ce215c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i've grokked this, good to open up support for more setups.
Why would you not have deferred FKs though 🤔
@@ -33,7 +33,7 @@ export class AuthorCodegen { | |||
// ...all the boilerplate fields & m2o/o2m/m2m relations generated for you... | |||
readonly books: Collection<Author, Book> = hasOne(...); | |||
get firstName(): string { ... } | |||
set firstName(): string { ... } | |||
set firstName(value: string): string { ... } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱
packages/codegen/src/index.ts
Outdated
|
||
await writeAlterTables(nonDeferredFks); | ||
|
||
if (setting === "error") hasError ??= true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just hasError = true
?
.filter((m2o) => m2o.notNull) | ||
.forEach((m2o) => { | ||
const added = addDependency(graph, entity, m2o); | ||
if (Array.isArray(added)) notNullCylces.push(added.join(" -> ")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: spelling "Cylces"
@zgavin totally agreed; my hope is that users will use the So just want to lower the bar/entry point, at least for PG setups. |
* feat: Support schemas with non-deferred FKs. * PR feedback. 3577c18
# [1.169.0](v1.168.2...v1.169.0) (2024-05-30) ### Features * Support schemas with non-deferred FKs. ([#1100](#1100)) ([3577c18](3577c18))
🎉 This PR is included in version 1.169.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Todo:
Fixes #1097