Class: Hanami::Model::Migration Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/model/migration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Database migration

Since:

  • 0.7.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateway, &block) ⇒ Migration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Migration.

Since:

  • 0.7.0



20
21
22
23
24
# File 'lib/hanami/model/migration.rb', line 20

def initialize(gateway, &block)
  @gateway = gateway
  @migration = gateway.migration(&block)
  freeze
end

Instance Attribute Details

#gatewayObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.7.0



12
13
14
# File 'lib/hanami/model/migration.rb', line 12

def gateway
  @gateway
end

#migrationObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.7.0



16
17
18
# File 'lib/hanami/model/migration.rb', line 16

def migration
  @migration
end

Instance Method Details

#run(direction = :up) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.7.0



28
29
30
# File 'lib/hanami/model/migration.rb', line 28

def run(direction = :up)
  migration.apply(gateway.connection, direction)
end