Hi,
I'm working on a project where the database design was done by a non-rails developer. I have .sql file with create table scripts. Is there anything out there to convert a .sql file to Rails Migrations?
Thanks in advance. Scott.
Hi,
I'm working on a project where the database design was done by a non-rails developer. I have .sql file with create table scripts. Is there anything out there to convert a .sql file to Rails Migrations?
Thanks in advance. Scott.
go to the db directory and say:
rake schema_dump
(which creates a new schema.rb from the database specified in database.yml)
Actually, you can run this (and any other rake tasks) from anywhere in the project tree. Rake shares a cool feature with Ant[1] - if it can't find a Rakefile in the current directory, it will look in the parent directory, then *that* directorys parent, and so on until it finds one (that's why it prints 'in /foo/blah/projectdir' to tell you where it found the Rakefile).
Dick.
[1] despite it's java roots, ant was one of the better build tools I've used. Saved me weeks of work, and made java development almost pleasant.