rubyramazesequel

Ramaze with Sequel Migrations?


I'm trying to get migrations set up in Ramaze. I'm coming from doing mostly Rails stuff, but I wanted to give something else a shot. Anyway, I've got a directory in my project called "migrations" with a start.rb file and then my migrations. Here's start.rb:

require File.expand_path('../app.rb', File.dirname(__FILE__))
require 'sequel/extensions/migration.rb'

Sequel::Migrator.apply(DB, '.')

Now, first of all, I don't know why I can't just do

Sequel::Model.plugin(:migration)

instead of that long require, but it seems to be working, so I'm not worrying about it too much. The main problem is that none of my migrations actually run. It creates the schema_info table, so I know it's trying to work, but it just can't find my 000_initial_info.rb file that's right there in the same directory.

I couldn't really find any documentation on this, so this is my own solution. I'd love to hear other solutions as well if I'm just going about this all wrong. Thanks for any help!


Solution

  • You can't use Sequel::Model.plugin :migration because migration is not a model plugin, it is a core extension. This will work:

    Sequel.extension :migration

    Sequel comes with the bin/sequel tool that you can use to run migrations with the -m switch:

    sequel -m /path/to/app/migrations

    Unless you have special needs, I recommend using that.

    One of the problems with your setup might be that you started your migrations at 000. Start them at 001 and it may work better.

    There's rdoc documentation for the Migrator:

    http://sequel.rubyforge.org/rdoc-plugins/classes/Sequel/Migrator.html