If I have a table in MySQL on an existing Rails project, how do I go to
creating a migration for it? All the examples I see online seem to be
geared to creating models and tables from a migration -- but how do I go
the other way and create a migration itself from a table? Thank you.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/UI18e-bpkK4J.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Colin Law at Nov 15, 2012 at 4:11 pm

    On 15 November 2012 16:01, RVince wrote:
    If I have a table in MySQL on an existing Rails project, how do I go to
    creating a migration for it? All the examples I see online seem to be geared
    to creating models and tables from a migration -- but how do I go the other
    way and create a migration itself from a table? Thank you.
    Why would you want to create a migration if you already have the table?

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • RVince at Nov 15, 2012 at 4:17 pm
    I have to commit my code changes on this specific project and it has to
    comport to having a migration for a new db table that was required here. I
    could cobble one by hand, but I think that's even more kludgey! I assume it
    isn't possible to go from a table to a migration? Thanks.
    On Thursday, November 15, 2012 11:12:31 AM UTC-5, Colin Law wrote:

    On 15 November 2012 16:01, RVince <rvin...@hotmail.com <javascript:>>
    wrote:
    If I have a table in MySQL on an existing Rails project, how do I go to
    creating a migration for it? All the examples I see online seem to be geared
    to creating models and tables from a migration -- but how do I go the other
    way and create a migration itself from a table? Thank you.
    Why would you want to create a migration if you already have the table?

    Colin
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Zq-o7GEhaSoJ.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Walter Lee Davis at Nov 15, 2012 at 4:17 pm

    On Nov 15, 2012, at 11:01 AM, RVince wrote:

    If I have a table in MySQL on an existing Rails project, how do I go to creating a migration for it? All the examples I see online seem to be geared to creating models and tables from a migration -- but how do I go the other way and create a migration itself from a table? Thank you.
    Look in the schema.rb. That's your "up" method, and "down" is always the same: drop_table :foo.

    Walter

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 15, '12 at 4:09p
activeNov 15, '12 at 4:17p
posts4
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase