Path: | doc/release_notes/3.18.0.txt |
Last Update: | Fri May 17 14:35:09 +0000 2013 |
Sequel.migration do change do create_table(:artists) do primary_key :id String :name, :null=>false end end end
The change block acts the same way as an up block, except that it automatically creates a down block that reverses the changes. So the above is equivalent to:
Sequel.migration do up do create_table(:artists) do primary_key :id String :name, :null=>false end end down do drop_table :artists end end
The following methods are supported in a change block:
Use of an other method in a change block will result in the creation of a down block that raises an exception.
Both the to_dot extension and reversible migrations support were inspired by Aaron Patterson‘s recent work on ActiveRecord and ARel.
DB = Sequel.connect(..., :servers_hash=>Hash.new(:some_shard))
You can also use this feature to raise an exception if an unconfigured shard is used:
DB = Sequel.connect(..., :servers_hash=>Hash.new{raise ...})