Hi Gabriel,

The `type` parameter is actually ignored when removing a column — see the
documentation for `remove_column` here
<http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-remove_column>
which
specifies that as well.

The docs also indicate why you might want to include it anyway — if your
migration is implemented using a `change` method instead of `up` and `down`
methods, that parameter indicates what type of column should be added back
if you revert the migration.

Hope that helps,
T.J.

P.S. — This mailing list (rubyonrails-core) is intended for discussion
about development of the framework itself, not usage of it.

For questions like this one that are not issues with Rails itself, please
post to the rubyonrails-talk mailing list (
http://groups.google.com/group/rubyonrails-talk) or somewhere like
StackOverflow using the `ruby-on-rails` tag (
http://stackoverflow.com/questions/tagged/ruby-on-rails).  You can also
drop in to the #rubyonrails channel on irc.freenode.net for realtime help.
You'll be more likely to get a quick answer in the future using one of
those options.

On Mon, Nov 14, 2016 at 1:47 PM, Gabriel Matos <
[email protected]> wrote:

> Hello guys,
>
> I've been using Ruby for a long time now and a simple doubt always make me
> wonder....
> Why do i need do specify the column type when removing a column?
>
> I always do the following when removing a column:
>
> remove_column :table, :column, :type
>
> But the thing is...isn't the column name unique? Or can i have multiple
> columns with same name but different types?
>
> Sorry if it's a stupid question tho :P
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to