Sql -> migrations?


#1

Is there a way to take a db schema (say, as sql statements) and
reverse that back into files to use for migrations? how do you handle
legacy db’s – do you have to go and write the migration files
yourself from scratch? -Janna B.


#2

Try pointing your config/database.yml at your legacy db & run ‘rake
db:schema:dump’. That should dump the current schema out to
db/schema.rb.

HTH,

-Roy