Module: ROM::SQL::Migration
- Included in:
- Repository
- Defined in:
- lib/rom/sql/migration.rb,
lib/rom/sql/migration/migrator.rb
Defined Under Namespace
Classes: Migrator
Class Attribute Summary collapse
-
.connection ⇒ Object
Returns the value of attribute connection.
- .path ⇒ Object
Class Method Summary collapse
Instance Method Summary collapse
- #migration(&block) ⇒ Object
-
#run_migrations(options = {}) ⇒ Object
Run migrations for a given repository.
Class Attribute Details
.connection ⇒ Object
Returns the value of attribute connection.
71 72 73 |
# File 'lib/rom/sql/migration.rb', line 71 def connection @connection end |
.path ⇒ Object
73 74 75 |
# File 'lib/rom/sql/migration.rb', line 73 def path @path || Migrator::DEFAULT_PATH end |
Class Method Details
.create(&block) ⇒ Object
82 83 84 85 |
# File 'lib/rom/sql/migration.rb', line 82 def create(&block) warn "ROM::SQL::Migration.create is deprecated please use ROM::SQL.migration (#{caller[0]})" ::Sequel.migration(&block) end |
.included(klass) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/rom/sql/migration.rb', line 37 def self.included(klass) super klass.class_eval do option :migrator, reader: true, default: proc { |repository| Migrator.new(repository.connection) } end end |
.run(options = {}) ⇒ Object
77 78 79 80 |
# File 'lib/rom/sql/migration.rb', line 77 def run( = {}) warn "ROM::SQL::Migration.run is deprecated please ROM::SQL::Repository#run_migrations (#{caller[0]})" ::Sequel::Migrator.run(connection, path, ) end |
Instance Method Details
#migration(&block) ⇒ Object
49 50 51 |
# File 'lib/rom/sql/migration.rb', line 49 def migration(&block) migrator.migration(&block) end |
#run_migrations(options = {}) ⇒ Object
Run migrations for a given repository
64 65 66 |
# File 'lib/rom/sql/migration.rb', line 64 def run_migrations( = {}) migrator.run() end |