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
67 68 69 |
# File 'lib/sequel/extensions/migration.rb', line 67 def down @down end |
#up ⇒ Object
Proc used for the up action
70 71 72 |
# File 'lib/sequel/extensions/migration.rb', line 70 def up @up end |
Instance Method Details
#apply(db, direction) ⇒ Object
Apply the appropriate block on the Database
instance using instance_eval.
74 75 76 77 78 79 |
# File 'lib/sequel/extensions/migration.rb', line 74 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 |