Posts Tagged ‘migrations’

DataMapper 0.9.x and Mack

Sunday, June 1st, 2008

As I’ve told a lot of you my goal was to have a Mack release out by the end of RailsConf, which ends tomorrow, that would be rocking the newly released version of DataMapper, 0.9.1. The good news is I’ve pretty much got it all done, and it works great! The bad news is I’m not going to release it.

Why is this you might ask? Why aren’t I going to get Mack support for DataMapper 0.9.1 out there, if it already works. Great questions. The answer is simply this, migrations. I’ve spent most of the weekend hanging out with a great guy by the name of Adam French. Adam is one of the core developer’s of DataMapper. As a matter of fact, I just left Adam after we spent a couple of hours in the hotel bar writing a gem called, dm-voyeur, to allow for ‘observing’ of DataMapper::Resource objects.

Anyway, as I’ve been hanging out with Adam I’ve been trying to upgrade the Mack migration generator script to build the new style format for DataMapper 0.9.1. What I found though, was that migrations have a minor flaw, you have to write the SQL for the column! That means they aren’t portable! This bit me in the butt when I had a migration I wrote against Postgres that would run, but wouldn’t give me the results I expected in SQLite3. After spending most of the weekend complaining to Adam about this, he kindly pointed out that I have full commit access to DataMapper, and I should probably just fix the bloody thing myself. So that’s what I’ve done.

The great news is that migrations are now pretty sweet. The bad news is I’m not going to release Mack support for DataMapper 0.9.x until they put out the next release so everyone in the Mack universe can have a nice experience using the new migrations. Although I don’t know just when the next release of DataMapper will be, I estimate that it will be relatively soon. Keep an eye on this space.

Release 0.4.6

Friday, April 18th, 2008

This is a pretty cool release. First off Thin has been updated to 0.8.0, a rather nice, stable release. ERB has been replaced with Erubis to give a significant improvement in speed, which, after all is one of Mack’s most important traits. 

There’s been a general overhaul of the generators included with Mack. Mostly, cleaning them up. With that said things like the scaffold, model, and migration generators have been updated to do what a lot of people have been asking for, that is take a ‘cols’ parameter and build out the generated code corrrectly. This really makes life, very, very simple.

There will be a re-written ‘blog’ tutorial coming out soon to make use of this, as well as migration support that’s now part of Mack.

Very exciting stuff! Enjoy!

Changelog:

  • Mack now uses Erubis, http://www.kuwata-lab.com/erubis/, for it’s rendering engine instead of ERB. This makes Mack even faster now! Yippie!
  • Added rake generate:model name=<model_name> (optional: cols=<col_1>:<col_1_type>,<col_2>:<col_2_type>) This will also create a migration for you.
  • Updated rake generate:migration name=<model_name> (optional: cols=<col_1>:<col_1_type>,<col_2>:<col_2_type>) This will create the proper table migration for you.
  • Updated rake generate:scaffold to use the ModelGenerator now.
  • ScaffoldGenerator now create input fields based on the type of columns, if any, passed in.
  • Overall general refactoring of the generator classes.
  • Fixed a bug with request logging not, well, logging.
  • gem: erubis 2.5.0
  • gem: thin 0.8.0

Release 0.4.5

Monday, April 14th, 2008

Well, here it is! The release you all were waiting for, the one that finally gives migration support to Mack! That’s right, now whether you use ActiveRecord or DataMapper, you can use the familiar rake task ‘db:migrate’ to run your migrations. Yippie! The scaffold generator will also generate a migration for you, assuming you have ORM support enabled.

There’s still some work to go on this, like the ability to pass in command line args to the task to build the full migration for you, but it’s a start! It’s now pretty easy to get your app going.

Also in this release is a rewrite of the distributed routing functionality. It’s now been rewritten to use Rinda. This is going to be the standard for all the distributed functionality that will be coming Mack over the next couple of months. As more functionality lke this is developed, the more it will be wrapped in nice, easy to use APIs.

There’s also been some tidying up here in there in the code tree. For example, new applications don’t get generated with a boot.rb file. Looking at it, there’s really no need for it, since everything is done with Rake tasks.

Overall, I’m very happy with the release, and I feel that this release definitely makes Mack a VERY useable framework because of the migration support. Enjoy!

Changelog:

  • Removed boot.rb file. It was unnecessary.
  • When a new Mack application is generated the Rakefile that gets generated is stamped with the Mack gem version used to create it. This ties the project to that gem. This can, of course, be upgraded as new Mack gems come out, but it’s a good way of tying your app to a specific revision of Mack.
  • Added support for migrations for both ActiveRecord and DataMapper. DataMapper migration support requires DataMapper 0.3.0 gem. Please keep in mind, though, that DataMapper 0.3.0 has a serious bug in it, which may prevent you from using it. Please see http://www.mackframework.com/2008/04/09/horrible-bug-in-datamapper-030/ for more information.
  • Rewrote distributed routing support to use Rinda inside of plain old DRb. This makes for an almost zero configuration usage.
  • Added: mack_ring_server binary to start a Rinda ring server for use with distributed routing.
  • Sqlite3 is now the default database for Mack applications configured with ORM support.
  • Added a test helper method, rake_task, to aid in the testing of Rake tasks.
  • Added: rake generate:migration name=<migration_name>
  • Added: rake db:migrate
  • Added: rake db:abort_if_pending_migrations
  • Added: rake db:rollback
  • Added: rake db:version
  • Added: rake mack:ring_server:start
  • Added: rake mack:ring_server:stop
  • Added: rake mack:ring_server:restart
  • Added: rake mack:ring_server:services:list
  • gem: application_configuration 1.2.2
  • gem: daemons 1.0.10