Class | Sequel::Migration |
In: |
lib/sequel/extensions/migration.rb
|
Parent: | Object |
Sequel‘s older migration class, available for backward compatibility. Uses subclasses with up and down instance methods for each migration:
Class.new(Sequel::Migration) do def up create_table(:artists) do primary_key :id String :name end end def down drop_table(:artists) end end
Part of the migration extension.
Applies the migration to the supplied database in the specified direction.
# File lib/sequel/extensions/migration.rb, line 31 31: def self.apply(db, direction) 32: raise(ArgumentError, "Invalid migration direction specified (#{direction.inspect})") unless [:up, :down].include?(direction) 33: new(db).send(direction) 34: end
Returns the list of Migration descendants.
# File lib/sequel/extensions/migration.rb, line 37 37: def self.descendants 38: @descendants ||= [] 39: end
Adds the new migration class to the list of Migration descendants.
# File lib/sequel/extensions/migration.rb, line 42 42: def self.inherited(base) 43: descendants << base 44: end