-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Generate db files during hanami generate slice
#197
Conversation
…-during-hanami-generate-slice
…ing-hanami-generate-slice
Hey @cllns! Thanks again for working on this 😄 I just checked this out locally and tried passing Either way, I took some time to consider the I think that having these options would lead to confusion around their purpose. For example by default, one might consider the "app db" to be the actual service that In this case, I considered renaming this option to either
In addition, by removing these options, it means we can stop generating empty Now, how might users opt into these various DB layer arrangements without support from the generator? Instead of And instead of So as you can (hopefully!) see, it's not particularly onerous to opt into either of these alternative arrangements, even with the default behaviour of our generator. And since slices won't be created all too often compared to the lower-level files in the app, I think we can tolerate this generator being a little less flexible for starters, with the benefit of it being less confusing and pushing users more towards our preferred default in the meantime. I made a push to this PR pulling out the options, just to make it clear in the code what I've attempted to explain in so many words just above 😆 I hope that's OK! Please let me know what you think! |
Our Zeitwerk autoloading will take care of making these constants available for us.
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.
If you're happy with the commits I pushed here, I'm happy to see this go in! Everything else looks great 😄 Thank you!
Perfect. Definitely agree with streamlining this and making it simpler 🫡 |
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.
Thanks @cllns, let's get this in!
Closes #148. This still needs some more but I'm not sure exactly what, since I'm still a little unclear on how it'll all fit together.
When I use this
hanami new slice --app-db
I get an error (after generation, when the app tries to boot) becauseconfig.db.
isn't defined within Hanami::Slice. Do we need to add that inhanami-db
?Can you elaborate what else is needed for this PR @timriley?