-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add migrations_paths option to model generator #33994
Add migrations_paths option to model generator #33994
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @eileencodes (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review. Please see the contribution instructions for more information. |
This also fixes scaffold, I'll add a test for this. |
8ba0b7c
to
c9ff2d7
Compare
c9ff2d7
to
77aaece
Compare
Looks good thanks! |
I'm curious why the user facing API is to pass the migration paths and not the simpler db name? Perhaps I'm extrapolating from the simple multi db database.yml with the primary database and then the animals. But wouldn't it be easier to pass |
@kaspth I like that idea, maybe we should add support for both? The current implementation would still be useful for edge cases, I think. |
Let's change it to |
Sounds good, I'll get to work on it! |
…ors [ci skip] `migrations_paths` option was added to migration generator, with changelog entry, in rails#33760. Also `migrations_paths` option was added to model generator, with changelog entry, in rails#33994. Then `migrations_paths` was renamed to `database` and aliased as `db` in rails#34021, and was added new changelog entry. I think we should edit existed changelog entries instead adding new about changing the name of the option from `migrations_paths` to `database` since Rails 6.0 hasn't been released yet, and since It might confuse readers of the changelog file in case if they've read changelog enty about adding `migrations_paths` option but haven't read the entry about change the name of that option to `database`. @eileencodes, @gmcgibbon, @rafaelfranca Does it make sense?
* [Add migrations_paths option to migration generator](rails/rails#33760) * [Add migrations_paths option to model generator](rails/rails#33994) * [Refactor migrations_path command option to database](rails/rails#34021)
I would have liked --migrations_paths more. For example discourse plugins live in their own directories without having their own db. https://github.com/discourse/discourse/tree/master/plugins/poll/db/migrate Is there maybe another way to achieve something similar? |
Summary
Followup on #33760. Adds support for custom migrations path on
rails generate model
. Example:r? @eileencodes
/cc @rafaelfranca