Question

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!

Was it helpful?

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

OTHER TIPS

Here's my solution:

http://github.com/mwlang/ramaze-sequel-proto-experimental

Run "rake -T" to see the various db and migrate tasks I've written."

I use this "experimental" as my ramaze project template at the moment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top