The answer:

DB = Sequel.connect('mysql://user:passwd@localhost/extradb')
DB.create_table(:artists) do
  primary_key :id
  String :name, :null=>false
end

On Jul 27, 1:47 pm, rtacconi <[email protected]> wrote:
> Thank you Francois but I am getting:
>
> undefined method `singleton_method_added' for #<Sequel::MigrationDSL
>
> On Jul 27, 1:11 pm, François Beausoleil
>
>
>
>
>
>
>
> <[email protected]> wrote:
> > You need to load the migration extension. Search for "The migration 
> > extension" onhttp://sequel.rubyforge.org/rdoc/files/doc/migration_rdoc.html
>
> > Bye!
> > François
>
> > Le 2011-07-27 à 06:29, rtacconi <[email protected]> a écrit :
>
> > > Hi,
>
> > > I would like to run a migration inside a Sinatra get. I am getting:
>
> > > NoMethodError at /migration
> > > undefined method `migration' for #<Sequel::MySQL::Database: "mysql://
> > > user:passwd@localhost/extradb">
>
> > > The code:
>
> > > require 'rubygems'
> > > require 'sequel'
>
> > > DB = Sequel.connect('mysql://user:passwd@localhost/extradb')
> > > DB.migration do
> > >  def change
> > >    create_table(:artists) do
> > >      primary_key :id
> > >      String :name
> > >    end
> > >  end
> > > end
>
> > > I know that the code seems strange, but based on some meta-data info I
> > > would like to select a DB and modify the schema: create a tablle, add
> > > a column to a table. I do not want to run migrations the Sinatra why.
>
> > > --
> > > 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 
> > > athttp://groups.google.com/group/sequel-talk?hl=en.

-- 
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.

Reply via email to