The default migrator, recommended in most cases.  Uses a simple
            incrementing version number starting with 1, where missing or duplicate
            migration file versions are not allowed.  Part of the
            migration extension.
Constants
| DEFAULT_SCHEMA_COLUMN | = | :version | ||
| DEFAULT_SCHEMA_TABLE | = | :schema_info | ||
| Error | = | Migrator::Error | 
Attributes
| current | [R] | The current version for this migrator | 
| direction | [R] | The direction of the migrator, either :up or :down | 
| migrations | [R] | The migrations used by this migrator | 
Public Class methods
                  new
                  (db, directory, opts=OPTS)
                
                Set up all state for the migrator instance
                  
                    [show source]
                  
                  
              # File lib/sequel/extensions/migration.rb, line 504 def initialize(db, directory, opts=OPTS) super @target = opts[:target] || latest_migration_version @current = opts[:current] || current_migration_version raise(Error, "No current version available") unless current raise(Error, "No target version available, probably because no migration files found or filenames don't follow the migration filename convention") unless target @direction = current < target ? :up : :down @migrations = get_migrations end
Public Instance methods
                  is_current?
                  ()
                
                The integer migrator is current if the current version is the same as the target version.
                  
                    [show source]
                  
                  
              # File lib/sequel/extensions/migration.rb, line 517 def is_current? current_migration_version == target end
                  run
                  ()
                
                Apply all migrations on the database
                  
                    [show source]
                  
                  
              # File lib/sequel/extensions/migration.rb, line 522 def run migrations.zip(version_numbers).each do |m, v| t = Time.now lv = up? ? v : v + 1 db.log_info("Begin applying migration version #{lv}, direction: #{direction}") checked_transaction(m) do m.apply(db, direction) set_migration_version(v) end db.log_info("Finished applying migration version #{lv}, direction: #{direction}, took #{sprintf('%0.6f', Time.now - t)} seconds") end target end