Method: Sequel::Migrator.migrator_class
- Defined in:
- lib/sequel/extensions/migration.rb
permalink .migrator_class(directory) ⇒ Object
Choose the Migrator subclass to use. Uses the TimestampMigrator if the version number is greater than 20000101, otherwise uses the IntegerMigrator.
442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/sequel/extensions/migration.rb', line 442 def self.migrator_class(directory) if self.equal?(Migrator) raise(Error, "Must supply a valid migration path") unless File.directory?(directory) Dir.new(directory).each do |file| next unless MIGRATION_FILE_PATTERN.match(file) return TimestampMigrator if file.split('_', 2).first.to_i > 20000101 end IntegerMigrator else self end end |