Sha256: 71d250faaaa71ee41718d7917d7cb84539c0e6ed9058c413511f1ec29db78ade

Contents?: true

Size: 697 Bytes

Versions: 8

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true

require_relative '../env'
require_relative 'version'

module Dsu
  module Migration
    class Migrator
      class << self
        def migrate_if!(migration_services: [])
          return if migration_services.any? do |migration_service|
            migration_service.migrate_if!
            migration_service.class.migrates_to_latest_migration_version?
          end

          raise I18n.t('migrations.error.missing_current_migration_service', migration_version: Migration::VERSION)
        rescue StandardError => e
          puts I18n.t('migrations.error.failed', message: e.message)
          exit 1 unless Dsu.env.test?
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dsu-3.0.5 lib/dsu/migration/migrator.rb
dsu-3.0.4 lib/dsu/migration/migrator.rb
dsu-3.0.3 lib/dsu/migration/migrator.rb
dsu-3.0.1 lib/dsu/migration/migrator.rb
dsu-3.0.0 lib/dsu/migration/migrator.rb
dsu-3.0.0.beta.3 lib/dsu/migration/migrator.rb
dsu-3.0.0.beta.2 lib/dsu/migration/migrator.rb
dsu-3.0.0.beta.1 lib/dsu/migration/migrator.rb