I have a 5k line MySQL database structure from a legacy application and need to import this / convert this into a set of Rails db/migration files.
Are there tools out there for doing this?
Can one somehow tell Rails to connect to a legacy DB and pull out schema from it?
Thanks.
Rails has this capability built-in.
Point your rails app at the “legacy” schema by modifying database.yml (probably for your development environment).
Run
rake db:schema:export.Now you have a proper ruby file in the Migrations DSL at
db/schema.rb, which makes it agnostic (which implies it leaves out vendor-specific items too).Read this article: Migrations – Schema Dumping and You for details.