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.
Methods
Public Class
Public Instance
Public Class methods
apply
(db, direction)
Applies the migration to the supplied database in the specified direction.
[show source]
# File lib/sequel/extensions/migration.rb, line 32 def self.apply(db, direction) raise(ArgumentError, "Invalid migration direction specified (#{direction.inspect})") unless [:up, :down].include?(direction) new(db).send(direction) end
descendants
()
Returns the list of Migration descendants.
[show source]
# File lib/sequel/extensions/migration.rb, line 38 def self.descendants @descendants ||= [] end
inherited
(base)
Adds the new migration class to the list of Migration descendants.
[show source]
# File lib/sequel/extensions/migration.rb, line 43 def self.inherited(base) descendants << base end
new
(db)
Set the database associated with this migration.
[show source]
# File lib/sequel/extensions/migration.rb, line 26 def initialize(db) @db = db end
use_transactions
()
Don't allow transaction overriding in old migrations.
[show source]
# File lib/sequel/extensions/migration.rb, line 48 def self.use_transactions nil end
Public Instance methods
down
()
The default down action does nothing
[show source]
# File lib/sequel/extensions/migration.rb, line 53 def down end
method_missing
(method_sym, *args, &block)
Intercepts method calls intended for the database and sends them along.
[show source]
# File lib/sequel/extensions/migration.rb, line 57 def method_missing(method_sym, *args, &block) @db.send(method_sym, *args, &block) end
up
()
The default up action does nothing
[show source]
# File lib/sequel/extensions/migration.rb, line 62 def up end