Files changed (1)
So lambda the ultimate to the rescue. In fact the migration files are read and evaluated inside a quasiquote. If the library recognizes that the body of a migration holds a procedure, it invokes it and passes the database-adapter as its sole argument.
Now that I had the overall architecture, I was able to implement what I needed. This was a lot of fun actually.
and having a name hacking became even more fun. I implemented some more stuff which I found useful. Some of the features I'm going to outline here, for the entire functionality check out the [nomads documentation](http://wiki.call-cc.org/eggref/4/nomads).
Another common feature are migrations, that aren't reversible. Of course the library allows to express this situation. The migration file may simply hold #f to be considered irreversible. The developer can also add an optional message for irreversible migrations.
Now we can put it all together and create a simple program that can be used to manage the migrations. Here is a simple version that works like RoRs db:migrate rake task. It uses a custom callback that is invoked on each check point, which enables us to customize the way we report migrations. We're using Alex Shin's very cool [fmt egg](http://wiki.call-cc.org/eggref/4/fmt) to do so.
This was it! Check out CHICKEN and nomads if you like. Also have a look at all the other great eggs. Or better yet, provide some more.