I have a non-rails application that I want to use rails active-record migrations with.
I have done this before w/o any issue, but this time I was hoping I could somehow get AR migrations to generate a migration script of the existing database so I can build from that.
Is this possible?
(The only other solution for me is to re-create the entire db in a migration, which I don’t want to do if there is a built-in way somehow).
You want
rake schema:dumpit will create what is essentially a migration file for the existing database schema. Use the rails migration generator to create a new migration and copy the contents of the dump into it. That should bootstrap your migrations.UPDATE
To gain access to the necessary rake tasks you can init an empty rails application, setup the gemfile to use the appropriate driver gems for the database and setup the database.yml to point at your non-rails database. Your migrations will live inside the rails app but that’s all.