lib/rom/sql/migration/migrator.rb in rom-sql-0.9.1 vs lib/rom/sql/migration/migrator.rb in rom-sql-1.0.0.beta1
- old
+ new
@@ -1,21 +1,20 @@
+require 'pathname'
+require 'rom/types'
+require 'rom/initializer'
+
module ROM
module SQL
module Migration
class Migrator
- include Options
+ extend Initializer
DEFAULT_PATH = 'db/migrate'.freeze
VERSION_FORMAT = '%Y%m%d%H%M%S'.freeze
- option :path, reader: true, default: DEFAULT_PATH
+ param :connection
- attr_reader :connection
-
- def initialize(connection, options = {})
- super
- @connection = connection
- end
+ option :path, type: ROM::Types.Definition(Pathname), reader: true, default: proc { DEFAULT_PATH }
def run(options = {})
Sequel::Migrator.run(connection, path.to_s, options)
end