Sequel version 0.1.9.3 has just been released. This release adds new
database migration functionality and support for specifying field
sizes in schema definitions.

Following is a discussion of the main changes:

Database migrations
===================

Sequel now includes migration functionality, thanks to Florian A?mann.
The migrator works in very similar fashion to ActiveRecord (Rails)
migrations. Each migration is defined as a descendant of
Sequel::Migration with #up and #down methods, e.g.:

  class CreateSessions < Sequel::Migration
    def up
      create_table :sessions do
        primary_key :id
        varchar   :session_id, :size => 32, :unique => true
        timestamp :created_at
        text      :data
      end
    end

    def down
      drop_table :sessions
    end
  end

You can manually apply the migration as follows:

  CreateSessions.apply(DB, :up)

There is also a Sequel::Migrator which can apply migrations and keep
track of the current schema version by storing it in a schema_info
table in the database. This is actually how ActiveRecord keeps track
of migrations, so Sequel and ActiveRecord are compatible in this
respect.

The migrator can apply migrations by loading migration files stored in
a specific directory. The migration files should be named using the
ActiveRecord convention, e.g.:

  001_create_sessions.rb
  002_create_users.rb
  ...

To migrate your database to the latest version, you just need to
supply the database instance and the directory containing the
migration files, e.g.:

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

You can also undo all migrations as follows:

  Sequel::Migrator.apply(DB, '.', 0) # the database is taken back to
version 0.

Or specify a specific version:

  Sequel::Migrator.apply(DB, '.', 5) # we're now in version 5.

Note: It is advisable not to use the migrator on production data. This
code is largely untested (though it conforms to the spec.)

Support for specifying field sizes in schema definitions
========================================================

This is another patch from Florian A?mann. You can now specify field
sizes when defining schemas, e.g.:

  DB.create_table :items
    varchar :name, :size => 32
    ...
  end

Note that if a varchar field is specified without a size, the size is
presumed to be 255.

Miscellanea
===========

* Improved robustness of MySQL::Dataset#field_name.

* Added Sequel.single_threaded= convenience method.

================================

Sequel project page:
  <http://code.google.com/p/ruby-sequel>

Sequel documentation:
  <http://sequel.rubyforge.org>

Join the Sequel-talk group:
  <http://groups.google.com/group/sequel-talk>

Install the gem:
  sudo gem install sequel

Or check out the source and install manually:
  svn co http://ruby-sequel.googlecode.com/svn/trunk sequel
  cd sequel
  rake install