Hmmm. Perhaps I missed something, but Sequel::Migrator is not
defined:
>> require 'sequel'
=> true
>> DB = Sequel.connect(:adapter => 'mysql', :user => 'root', :database =>
>> 'castle_gameserver')
=> #<Sequel::MySQL::Database: "mysql:root@/castle_gameserver">
>> Sequel::Migrator.apply(DB, '/myproject/db/migrations/')
NameError: uninitialized constant Sequel::Migrator
from (irb):3
I thought maybe you forgot a middle module (like maybe
Sequel::SQL::Migrator or something), so I checked the rdoc
http://sequel.rubyforge.org/rdoc/index.html
And searched for "Migrator". Nothing. What am I doing wrong here?
On a different note, since I'm not good at letting things go:
I tried setting RUBYLIB as you show above, but now I get a new error:
$ export RUBYLIB=/System/Library/Frameworks/Ruby.framework/Versions/
1.8/usr/lib/ruby/1.8/
$ sequel mysql://localhost/castle_gameserver?user=root
/usr/bin/sequel:19: undefined method `bin_path' for Gem:Module
(NoMethodError)
What gives?
On Jul 2, 1:23 pm, Jeremy Evans <[email protected]> wrote:
> On Jul 2, 12:08 pm, Steve H <[email protected]> wrote:
>
>
>
>
>
> > > Can you try using the RUBYLIB
> > > environment variable and make sure that one of the working mysql
> > > libraries first?
>
> > I tried this. It didn't work, but maybe I was doing something wrong?
>
> > $ gem which mysql
> > (checking gem mysql-2.7 for mysql)
> > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
> > 1.8/mysql.rb
> > $ export RUBYLIB=/System/Library/Frameworks/Ruby.framework/Versions/
> > 1.8/usr/lib/ruby/1.8/mysql.rb
> > $ echo $RUBYLIB
> > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
> > 1.8/mysql.rb
> > $ sequel mysql://localhost/castle_gameserver?user=root
> > Error: Sequel::DatabaseConnectionError: NameError uninitialized
> > constant Mysql::CLIENT_MULTI_RESULTS/Library/Ruby/Gems/1.8/gems/
> > sequel-3.1.0/lib/sequel/adapters/mysql.rb:97:in `connect'
>
> RUBYLIB should be a directory, not a file:
>
> export RUBYLIB=/System/Library/Frameworks/Ruby.framework/Versions/
> 1.8/usr/lib/ruby/1.8/
>
> > $ irb>> require 'sequel' rescue nil
> > => true
> > >> p $:
>
> > ["/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
> > 1.8/mysql.rb", "/Library/Ruby/Gems/1.8/gems/sequel-3.1.0/bin", "/
> > Library/Ruby/Gems/1.8/gems/sequel-3.1.0/lib", "/Library/Ruby/Site/
> > 1.8", "/Library/Ruby/Site/1.8/powerpc-darwin9.0", "/Library/Ruby/Site/
> > 1.8/universal-darwin9.0", "/Library/Ruby/Site", "/System/Library/
> > Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8", "/System/
> > Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/
> > powerpc-darwin9.0", "/System/Library/Frameworks/Ruby.framework/
> > Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0", "."]
> > => nil
>
> You have to go through those directories in order to find the first
> one that contains a mysql.rb or mysql.so file (maybe there's a
> different extension for shared library extensions on the Mac, I'm not
> sure). That one needs to support CLIENT_MULTI_RESULTS in order for
> Sequel to work. My guess is the first one doesn't work, so you need
> to set RUBYLIB to the directory containing the correct mysql file, or
> modify the load path manually so that that directory is the first one
> reached that contains a mysql file.
>
> > Any other ideas? All I want to do is be able to run migrations. Is
> > there some way to do that from within irb?
>
> Before you can run migrations, you need to setup your database
> connection. Once your database connection is setup, running
> migrations is trivial:
>
> Sequel::Migrator.apply(DB, '/path/to/migrations/dir')
>
> Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---