Skip to content

Support creating a table migration generator#8652

Merged
carlosantoniodasilva merged 1 commit intorails:masterfrom
codeodor:create_table_migration
Mar 1, 2013
Merged

Support creating a table migration generator#8652
carlosantoniodasilva merged 1 commit intorails:masterfrom
codeodor:create_table_migration

Conversation

@codeodor
Copy link
Copy Markdown
Contributor

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:

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be moved to the top.

@steveklabnik
Copy link
Copy Markdown
Member

I like it. 👍

@codeodor
Copy link
Copy Markdown
Contributor Author

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

@robin850
Copy link
Copy Markdown
Member

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! :)

@steveklabnik
Copy link
Copy Markdown
Member

Yes, I mean it should be at the top of the file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file don't exist anymore since you moved to create_table_migration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is obvious the problem was github with the misleading information that the file was renamed.

Screen Shot 2013-02-25 at 10 45 55

Sorry

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@codeodor
Copy link
Copy Markdown
Contributor Author

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?)

@rafaelfranca
Copy link
Copy Markdown
Member

Could you squash the commits and rebase against master? It cannot be automatically merged

@codeodor
Copy link
Copy Markdown
Contributor Author

Ok, I rebased onto master, and the PR contains one commit. How does it look now?

@milushov
Copy link
Copy Markdown

milushov commented Mar 1, 2013

👍 👍 👍

@carlosantoniodasilva
Copy link
Copy Markdown
Member

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.
@codeodor
Copy link
Copy Markdown
Contributor Author

codeodor commented Mar 1, 2013

Ok, done. Does it say it will merge cleanly?

@carlosantoniodasilva
Copy link
Copy Markdown
Member

Yup it does. Thank you!

carlosantoniodasilva added a commit that referenced this pull request Mar 1, 2013
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.
@carlosantoniodasilva carlosantoniodasilva merged commit b49a2a7 into rails:master Mar 1, 2013
@codeodor
Copy link
Copy Markdown
Contributor Author

codeodor commented Mar 1, 2013

Awesome, thanks! 👍 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants