Class: PG::Schema::MigrationDSL
- Inherits:
- BasicObject
- Defined in:
- lib/pg/schema-migration.rb
Instance Attribute Summary collapse
-
#migration ⇒ Object
readonly
Returns the value of attribute migration.
Instance Method Summary collapse
- #down(&block) ⇒ Object
- #execute(command) ⇒ Object
-
#initialize(&block) ⇒ MigrationDSL
constructor
A new instance of MigrationDSL.
- #up(&block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ MigrationDSL
Returns a new instance of MigrationDSL.
40 41 42 43 |
# File 'lib/pg/schema-migration.rb', line 40 def initialize(&block) @migration = Migration.new instance_eval(&block) end |
Instance Attribute Details
#migration ⇒ Object (readonly)
Returns the value of attribute migration.
38 39 40 |
# File 'lib/pg/schema-migration.rb', line 38 def migration @migration end |
Instance Method Details
#down(&block) ⇒ Object
50 51 52 53 |
# File 'lib/pg/schema-migration.rb', line 50 def down(&block) @commands = [] @migration.down = block.call end |
#execute(command) ⇒ Object
55 56 57 |
# File 'lib/pg/schema-migration.rb', line 55 def execute(command) @commands << command end |
#up(&block) ⇒ Object
45 46 47 48 |
# File 'lib/pg/schema-migration.rb', line 45 def up(&block) @commands = [] @migration.up = block.call end |