class SequelMigrationsToys::Template::Run

Define toys for run migrations

Constants

SEQUEL_EXTENSIONS

Public Instance Methods

find_target_file_version() click to toggle source
# File lib/sequel_migrations_toys/template/run.rb, line 58
def find_target_file_version
        file =
                migration_file_class(@template.db_migrations_dir).find_one target, disabled: false

        abort 'Migration with this version not found' if file.nil?

        puts "Migrating from #{current} to #{file.basename}"
        file.version
end
options() click to toggle source
# File lib/sequel_migrations_toys/template/run.rb, line 37
def options
        result = { allow_missing_migration_files: force }

        return result.merge! target_options if target

        puts 'Migrating to latest'
        result
end
target_options() click to toggle source
# File lib/sequel_migrations_toys/template/run.rb, line 46
def target_options
        target_version =
                if target == '0'
                        puts 'Migrating all the way down'
                        target
                else
                        find_target_file_version
                end

        { current: current.to_i, target: target_version.to_i }
end