Support creating a table migration generator#8652
Support creating a table migration generator#8652carlosantoniodasilva merged 1 commit intorails:masterfrom
Conversation
activerecord/CHANGELOG.md
Outdated
There was a problem hiding this comment.
This needs to be moved to the top.
|
I like it. 👍 |
|
Thanks Steve. When you say "this needs to be moved to the top," what are you referring to? That I need to move the changelog entry to the top of the file instead of the bottom of the file? Sam |
|
Seems good. I'm 👍 on this! I allow myself to answer your question : yes, you should move your changelog entry to the top of the file. Thanks for your contribution! :) |
|
Yes, I mean it should be at the top of the file. |
There was a problem hiding this comment.
This file don't exist anymore since you moved to create_table_migration
There was a problem hiding this comment.
This file still exists and is the default file for taking care of the other migrations. See Line 30-32 where it uses create_table_migration.rb for migrations which create tables.
Do you have any suggestion for how I can improve the code to make this more obvious/clear?
There was a problem hiding this comment.
Thanks for letting me know. I'll try to be more clear next time. For what it's worth, the file did get moved: it used to live with the model generator, while now it is with the migration generator.
|
Ok, I moved the changelog entry to the top of the file. Any other feedback? (for example, should I pull from rails/master and merge?) |
|
Could you squash the commits and rebase against master? It cannot be automatically merged |
|
Ok, I rebased onto master, and the PR contains one commit. How does it look now? |
|
👍 👍 👍 |
|
Looks good 👍. But github says it cannot be automatically merged, can you please rebase again? (it's likely a changelog conflict). |
Sometimes you want to create a table without an associated model and
test, which is also not a join table. With this commit, you can now
do that.
Example:
rails g migration create_posts title:string
or
rails g migration CreatePosts title:string
This commit also moves the template the model generator uses for the
migration to the migration templates folder, as it seems a more
sensible place for it now that it is shared code.
|
Ok, done. Does it say it will merge cleanly? |
|
Yup it does. Thank you! |
Support creating a table migration generator
Sometimes you want to create a table without an associated model and
test, which is also not a join table. With this commit, you can now
do that.
Example:
rails g migration create_posts title:string
or
rails g migration CreatePosts title:string
This commit also moves the template the model generator uses for the
migration to the migration templates folder, as it seems a more
sensible place for it now that it is shared code.
|
Awesome, thanks! 👍 ❤️ |

Sometimes you want to create a table without an associated model and test, which is also not a join table. With this commit, you can now do that.
I've typed these commands enough times over the years and ended up with empty migrations that I finally decided to add them to Rails and see if anyone else considered it useful.
Example:
or
This commit also moves the template the model generator uses for the migration to the migration templates folder, as it seems a more sensible place for it now that it is shared code.