that is a great idea and I had that thought. It has several tables and some of the table many fields so is there an easy way to do that? Do you think taking a SQL dump of the DB and then copy paste most it into the migration file and then run rake db:migrate?? any other suggestions? I would think this is a very common thing amongst rails developers being that often you are given the data or some of it, regardless of if the DB is already relied upon or not - wanted to make sure I was doing things smartly
On May 5, 5:30 pm, Larry Meadors <[email protected]> wrote: > Why not start from scratch with a rails-created database, then import > the old data into it? > > Seems like it'd be the least pain solution. > > Larry > > > > > > On Wed, May 5, 2010 at 3:23 PM, agilehack <[email protected]> wrote: > > I am starting a new rails project and have been given a DB with data > > etc. The good news is that the data is not being used by any other > > system so even though the DB has been designed and given to me I have > > liberty to change as needed. My goal would be to tweak the DB before > > starting to work well follow rails conventions. I will change table > > names and add the created_at, modified_at fields manually. My issue > > comes in with the ID field/primary key. I would love to add the ID > > field as primary key and auto_increment so that I can create my Rails > > app fresh and everything works as if I created through a migration. > > Trouble being that each table already has a primary key, usually > > <tablename_id> and that field also exists in other tables. So I cant > > just change the field name to ID. But since the DB isn't being used > > by any other system, can I just create a new column named ID and make > > it the primary key(auto_increment) and remove the primary key status > > from the existing? In this scenario all the data given to me remains > > intact I just create and change the primary key. Or would this > > destroy the data relationships of these table and cause more issues > > down the road? > > > -- > > 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 [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

