Moving data from legacy database

I have rewritten a java webapp into rails. The database structure is
basically the same except that:

  1. in the legacy app, several of the tables did not use ID numbers,
    but relied on other fields as the primary key
  2. in the legacy app, there is a join table that uses email address
    and category names to do the join, not ID numbers

I would like to move or change this database to match my new rails
schema. Does anyone have any suggestions as to the easiest way to do
this?

Thanks ,
Shelby

On Sun, 2006-07-02 at 20:37 -0500, Shelby W. wrote:

I have rewritten a java webapp into rails. The database structure is
basically the same except that:

  1. in the legacy app, several of the tables did not use ID numbers,
    but relied on other fields as the primary key
  2. in the legacy app, there is a join table that uses email address
    and category names to do the join, not ID numbers

I would like to move or change this database to match my new rails
schema. Does anyone have any suggestions as to the easiest way to do
this?


you can identify the primary keys in your legacy database like this
http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas

or you could create a new database and import your data from the old
into the new

the choice of course is yours - it does make rails easier to stay within
the normal conventions when you are learning but it’s flexible enough to
play with the cards it is dealt.

Craig

I realized that I could add an ID column to the legacy tables simply
by doing an SQL alter table (using Cocoa MySQL), and making the id
column auto-increment. voila - an id column.

So really all I face now is the join table. I’ll have to figure out
that…

Shelby