0

I am trying to figure out how to build a rails app on top of an existing mysql db. I think the best method would just be to create a migration with the same layout as the existing db, but I am not quite sure how to do this, then connect it. I am aware of this post Building Ruby on Rails App with an existing Mysql db

but am still unsure; do I just do this but with the columns I need? Also the main answer to this question is saying that I should make my db a csv and then import it, does anyone have a tutorial or gem they recommend for that?

Community
  • 1
  • 1
mrtriangle
  • 542
  • 11
  • 28

2 Answers2

1

Before that, try to learn more about rails and it's conventions. Probably you'll need to adapt your database scheme. Or you could start an application and then import the data, even by SQL or by CSV as you mentioned. Migrating data can be a tedious work, but a necessary one.

You can check this gem to see if it helps on your case, because it will depend on your actual schema.

Paulo Fidalgo
  • 21,709
  • 7
  • 99
  • 115
1

I have not done this exact task personally although when I modify my databases manually through my mysql client and create backup tables for example, they magically appear in my schema.rb file later down the road when I run some future migrations.

So the following post should help or at least point you in the right direction:

http://tianhsky.ueuo.com/blog/2012/02/20/generate-schema-rb-from-existing-database/

tronmcp
  • 346
  • 1
  • 6