Regenerating SDL from updated schema has been up for some discussion for awhile with ideas of making be a smart off and only adding in changes or forcing a full overwrite.
I wrote the “Regenerating the SDL” docs here Command Line Interface | RedwoodJS Docs to give some options to make sure you don’t lose tests or stories.
But, typically people do two things:
- Generate the SDL from schema once and then manually update sdl.ts for new/updated fields
- Keep the CRUD sdl intact and in generated for such that it can always ge generated code. Then make custom sdl.ts and custom services for your non-crud behavior.
So your Post sdl generate makes post, posts, and its mutations. All generated.
Then have myPosts service where there is a myPost query and method that filters posts by current user id.
I tend to do the latter.