We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In the past I've generally preferred class-per-table subclasses, but it might be neat to support single-table subclasses with a scheme like:
Designate a type column and determines the subclass in joist-codegen.json:
type
joist-codegen.json
UserEvent: { fields: { type: { subclasses: { COMMENTED: { name: "CommentUserEvent", fields: ["comment"] }, LIKED: { name: "LikeUserevent", fields: ["post", "author"] }, } } }
Or maybe re-arranged slightly:
UserEvent: { subclassDiscriminator: "type", subclasses: { COMMENTED: { name: "CommentUserEvent", fields: ["comment"] }, LIKED: { name: "LikeUserEvent", fields: ["post", "author"] }, }
And then codegen would output:
UserEventCodegen.ts
UserEvent.ts
CommentUserEventCodegen.ts
CommentUserEvent.ts
Questions:
m2o
CommentUserEvent
The text was updated successfully, but these errors were encountered:
Implemented in #966
Sorry, something went wrong.
No branches or pull requests
In the past I've generally preferred class-per-table subclasses, but it might be neat to support single-table subclasses with a scheme like:
Designate a
type
column and determines the subclass injoist-codegen.json
:Or maybe re-arranged slightly:
And then codegen would output:
UserEventCodegen.ts
as-isUserEvent.ts
as-isCommentUserEventCodegen.ts
, new, extends UserEvent, marks comment as requiredCommentUserEvent.ts
, new, touched once, for subclass-specific business logic.Questions:
m2o
s to "only a subclass" i.e. only aCommentUserEvent
. In CPTI (class per table), them2o
FK just points to the subclass columnThe text was updated successfully, but these errors were encountered: