class Sequel::SimpleMigration

  1. lib/sequel/extensions/migration.rb
Superclass: Object

Migration class used by the Sequel.migration DSL, using instances for each migration, unlike the Migration class, which uses subclasses for each migration. Part of the migration extension.

Methods

Public Class

  1. new

Public Instance

  1. apply
  2. down
  3. up
  4. use_transactions

Attributes

down [RW]

Proc used for the down action

up [RW]

Proc used for the up action

use_transactions [RW]

Whether to use transactions for this migration, default depends on the database.

Public Class methods

new ()

Don't set transaction use by default.

[show source]
# File lib/sequel/extensions/migration.rb, line 97
def initialize
  @use_transactions = nil
end

Public Instance methods

apply (db, direction)

Apply the appropriate block on the Database instance using instance_exec.

[show source]
# File lib/sequel/extensions/migration.rb, line 103
def apply(db, direction)
  raise(ArgumentError, "Invalid migration direction specified (#{direction.inspect})") unless [:up, :down].include?(direction)
  if prok = public_send(direction)
    db.instance_exec(&prok)
  end
end