Class: Sequel::SimpleMigration
- Defined in:
- lib/sequel/extensions/migration.rb
Overview
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.
Instance Attribute Summary collapse
-
#down ⇒ Object
Proc used for the down action.
-
#up ⇒ Object
Proc used for the up action.
Instance Method Summary collapse
-
#apply(db, direction) ⇒ Object
Apply the appropriate block on the
Database
instance using instance_eval.
Instance Attribute Details
#down ⇒ Object
Proc used for the down action
66 67 68 |
# File 'lib/sequel/extensions/migration.rb', line 66 def down @down end |
#up ⇒ Object
Proc used for the up action
69 70 71 |
# File 'lib/sequel/extensions/migration.rb', line 69 def up @up end |
Instance Method Details
#apply(db, direction) ⇒ Object
Apply the appropriate block on the Database
instance using instance_eval.
73 74 75 76 77 78 |
# File 'lib/sequel/extensions/migration.rb', line 73 def apply(db, direction) raise(ArgumentError, "Invalid migration direction specified (#{direction.inspect})") unless [:up, :down].include?(direction) if prok = send(direction) db.instance_eval(&prok) end end |