-
Notifications
You must be signed in to change notification settings - Fork 1k
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(codegen): support sdl generation for model with compound id #8556
Conversation
Hi all, just wanted to check in on the status of this PR. Let me know when / if I can prepare for release. |
pinging @jtoar & @dthyresson |
@russell-dot-js Sorry this PR got stuck. I'll try to get you a decision on some next steps here. As noted in his PR we did decide to hold off on implementing this feature. But with community help (like yours!) maybe we can move forward. I'll discuss with the team. I do think his implementation looks a bit cleaner. But yours is newer and therefore probably easier to keep working on. Could you please compare your two's PRs and combine the best of both into this one? Either get started right now, or wait until the team has decided if this is something we're ready for now or not. |
Hey @russell-dot-js it would be awesome if you still wanted to work on this. The team wants to see this feature, but we don't have time to implement it ourselves now or in the close future. But would be happy to review your code and generally help you along if you're up for it. Some extra thought will probably have to be given to the Prisma part of the templates, and also the scaffold generator. Especially the forms the scaffolded stuff uses. Totally understand if you lost the motivation for this. If I don't hear back from you I'll just close this PR for now. For anyone else reading this, if we don't hear back from Russel you're more than welcome to pick up where this PR left off 🙂 |
I'm marking this one for close — the work here by @russell-dot-js is great so want to discuss it internally to see if we can first see if others in the community want to pick it up. |
@thedavidprice just saw your comments... a bit demotivating when my 3 pr's were ignored for about 6 months :( why can't this be merged as-is? there's already the option to use your own template for the generators based on how your app is structured, and it's non-breaking for apps that aren't already using compound id's (and it was previously unusable for compound id's, so in practice this PR, in its current state, has no downside) |
Completely understood @russell-dot-js We haven't supported you well across these three PRs. Given that we'd dropped the ball and hadn't heard back from you, I assumed you'd given up on us. Are you interested in picking this (and possibly the other two) up again? Let me know if so and I'll review with the team to see when we can offer you support. We are a small team and devoting 80% of our focus to Bighorn development right now. But we just talked today about resourcing some work on GQL and codegen, so the timing couldn't be better. |
I'm happy to get the three PR's across the finish line. It wasn't clear to me what's lacking in any of them from our convos thus far. If you can provide feedback I can find some time to make the changes |
Sounds good @russell-dot-js I'll follow up with the team so we can prioritize and get back to you about next steps. Regardless, we'll get you feedback + clarity. Appreciate your time and involvement. Truly! |
This hits me roughly once a month, including today - so I'd like to see this get in. I don't know if you've used this in a real project, but IMO, you'll probably also need to drop the check which throws in the CLI for the scaffolds ( look for |
@russell-dot-js handing this off to @orta (see his reply). You're in good hands! |
To be honest, I stopped using redwood after my PR's went stale because I didn't feel confident the framework could keep up with our needs, so I haven't used it in a "real" project, but I POC'd a project I later moved to Nest with this feature, and it was working great at the time. My experience was that >50% of scaffolded code will get deleted or refactored anyway, so just having it work and create the files as an entrypoint was the time saver I was looking for. Can you please elaborate the issue with |
Thank you so much for telling us this @russell-dot-js 🙏 |
Cool, yeah, this should have just gotten merged ages ago then - at some point I'll run the linter over this PR and fix the conflicts and we'll get it in |
This is now rebased, and passes lints etc, I'm going to hand off to someone else to wrap up getting it merged |
…edwood into feat/prisma-extension-crud-extra * 'feat/prisma-extension-crud-extra' of github.com:dac09/redwood: feat(codegen): support sdl generation for model with compound id (redwoodjs#8556) chore(ci): Follow up to workflow permissions (redwoodjs#11397) chore(deps): Bump 'loader-utils' within docs (redwoodjs#11396) chore(ci): Pin action dependencies by digest (redwoodjs#11395) chore(ci): More workflow permission changes (redwoodjs#11394) chore(ci): Add permissions to some workflows/jobs (redwoodjs#11393) Add OSSF scorecard action to our CI (redwoodjs#11392) chore(rsc): Rename rsf -> rsa (redwoodjs#11391) few Flightcontrol template & doc updates (redwoodjs#11383) chore(jobs tests): Fix a couple of TS issues (redwoodjs#11389)
…ads-storage * 'main' of github.com:redwoodjs/redwood: (32 commits) chore(uploads): Reorganise, change uploads package to storage (redwoodjs#11411) fix(cli-helpers): Don't add spaces around `=` for env vars (redwoodjs#11414) feat(uploads): Increase default fastify body limit to 100MB (redwoodjs#11412) chore: Rebuild fixture (redwoodjs#11413) chore(rsc): Refactor: Rename RscFetcher -> RscRoutes (redwoodjs#11409) chore(test-project): Update postcss to 8.4.42 (redwoodjs#11408) chore(rsc): Rename rscFetch to rscFetchRoutes and hardcode the rscId (redwoodjs#11407) feat(rsc): Initial support for RSA rerender (redwoodjs#11406) chore(router): Switch to experimental types (redwoodjs#11405) chore(router): Make React a normal dependency (redwoodjs#11404) feat(rsc): Return flight from RSAs (redwoodjs#11403) rscRequestHandler.ts: Make BASE_PATH naming match client.ts (redwoodjs#11401) fix(template): api type declaration merging for scripts (redwoodjs#11367) RSC: Disable client side flight caching for now (redwoodjs#11400) chore(fixtures): Use proper name for AuthLayout component (redwoodjs#11399) feat(storage): Add support for createMany, updateMany and upsert (redwoodjs#11390) feat(codegen): support sdl generation for model with compound id (redwoodjs#8556) chore(ci): Follow up to workflow permissions (redwoodjs#11397) chore(deps): Bump 'loader-utils' within docs (redwoodjs#11396) chore(ci): Pin action dependencies by digest (redwoodjs#11395) ...
partial resolution of #8552
with this prisma schema:
running
yarn rw g sdl temp
now generates:It's not perfect for the following reasons:
#2 and #3 above are easily fixable. In my opinion #3 above makes sense to fix, but for both #1 and #2, we cannot draw assumptions about what the developer intends to take as an input when using a compound primary key. Sometimes it might be part of the input, sometimes (in the case of tenantId) it might come from the authorized user and be invisible to the API consumers.
The important thing is, now you can generate your SDL's and modify from there. Previously, redwood threw an error and you couldn't use codegen.
This may be considered a breaking change because users who supply their own
sdl.{j,t}s.template
should now update to supportidInput
. However, since the feature didn't exist before, I personally don't consider this breaking.