Rails ActiveRecord migrations, without Rails?

Are there any frameworks out there that execute migrations as well as
Rails does? Or how difficult of a task would it be to extract the
migration functionality?

The practicality of having version control on changes made to a database
is a fantastic thing and I would love to get the migration functionality
available to Rails and apply it to any database.

I’ve started a very small app with newgen that does the initial
bootstrapping (just builds the simple directory structure, a blank
database.yml file and a simple Rakefile with some basic tasks), but I
have no migration generation yet as I would like to borrow as much from
Rails as possible (timestamps for versioning and such).

If anyone could point me in a direction, or would like me to start up a
project on Github, feel free to chime in. I think this would benefit
many others aside from me.

On Aug 7, 2:37 am, Matthew W. [email protected]
wrote:

Are there any frameworks out there that execute migrations as well as
Rails does? Or how difficult of a task would it be to extract the
migration functionality?

You could certainly have an almost empty rails app containing nothing
but migrations. With what I expect what be not too much work (and not
involving much rocket science) you could extract the relevant rake
tasks and do away with the empty husk of the application.

Fred

On Aug 7, 2:55 am, Frederick C. [email protected]
wrote:

On Aug 7, 2:37 am, Matthew W. [email protected]
wrote:> Are there any frameworks out there that execute migrations as well as

Rails does? Or how difficult of a task would it be to extract the
migration functionality?

You could certainly have an almost empty rails app containing nothing
but migrations. With what I expect what be not too much work (and not
involving much rocket science) you could extract the relevant rake
tasks and do away with the empty husk of the application.

Oh, and you can also use activerecord outside of rails completely -
it’s a standalone framework.

Fred

Frederick C. wrote:

On Aug 7, 2:55�am, Frederick C. [email protected]
wrote:

On Aug 7, 2:37�am, Matthew W. [email protected]
wrote:> Are there any frameworks out there that execute migrations as well as

Rails does? �Or how difficult of a task would it be to extract the
migration functionality?

You could certainly have an almost empty rails app containing nothing
but migrations. With what I expect what be not too much work (and �not
involving much rocket science) you could extract the relevant rake
tasks and do away with the empty husk of the application.

Oh, and you can also use activerecord outside of rails completely -
it’s a standalone framework.

Fred

I realize you can use ActiveRecord without and I do have a small base
with a few tasks to fire off migrations, like I mentioned,but I would
really like the migration generator that Rails provides and the other
functionality for versioning and rolling back which is not so out of the
box when using ActiveRecord standalone.

I have considered just using an empty Rails project and cleaning up the
rake file but that’s as clean of a solution as I would like though I may
end up going that route.

On Aug 7, 3:00 am, Matthew W. [email protected]
wrote:

involving much rocket science) you could extract the relevant rake
functionality for versioning and rolling back which is not so out of the
box when using ActiveRecord standalone.

Have you looked at the rake file ? There’s really not a lot too it.
All the migration stuff together is just over 30 lines. (The migration
generator stuff is not much more complicated, but the functionality is
a little more dispersed)

Eg the migrate task is just

ActiveRecord::Migrator.migrate(“db/migrate/”, ENV[“VERSION”] ?
ENV[“VERSION”].to_i : nil)

the rollback task is just

ActiveRecord::Migrator.rollback(‘db/migrate/’, ENV[‘STEP’] ?
ENV[‘STEP’].to_i : 1)

and so on.

Fred

Frederick C. wrote:

On Aug 7, 3:00�am, Matthew W. [email protected]
wrote:

involving much rocket science) you could extract the relevant rake
functionality for versioning and rolling back which is not so out of the
box when using ActiveRecord standalone.

Have you looked at the rake file ? There’s really not a lot too it.
All the migration stuff together is just over 30 lines. (The migration
generator stuff is not much more complicated, but the functionality is
a little more dispersed)

Eg the migrate task is just

ActiveRecord::Migrator.migrate(“db/migrate/”, ENV[“VERSION”] ?
ENV[“VERSION”].to_i : nil)

the rollback task is just

ActiveRecord::Migrator.rollback(‘db/migrate/’, ENV[‘STEP’] ?
ENV[‘STEP’].to_i : 1)

and so on.

Fred

Thanks for pointing out those tasks, it’s not too bad at all. I was
mostly focusing on the generators which are as you mentioned a little
more dispersed.