user672118
user672118

Reputation:

Sequel Migrator Not Defined

I'm trying to run some migrations on a database via Sequel's Sequel::Migrator. However, when I run...

DB = Sequel.sqlite
Sequel::Migrator.apply DB, 'db/migrations'

I got the following error.

uninitialized constant Sequel::Migrator

What gives?

Upvotes: 1

Views: 955

Answers (1)

user672118
user672118

Reputation:

Nowadays Sequel::Migrator is not included by default. This means that you just can't require 'sequel' and be able to start using Sequel::Migrator right away.

Instead you have to load the migration and core extensions provided by Sequel like so.

Sequel.extension :migration, :core_extensions

Now if you check whether Sequel::Migrator is defined Ruby should return "constant".

1.9.3 :001 > Sequel.extension :migration, :core_extensions
 => [:migration, :core_extensions]
1.9.3 :002 > defined? Sequel::Migrator
 => "constant"

Upvotes: 5

Related Questions