Sha256: 30ae4ab5c2e29b1186abefeed4bbcce754ee1d3bca33f372932887266224ea47

Contents?: true

Size: 807 Bytes

Versions: 5

Compression:

Stored size: 807 Bytes

Contents

module DataMigrate
  module Tasks
    module DataMigrateTasks
      extend self
      def migrations_paths
        @migrations_paths ||= begin
          if Rails.application && Rails.application.paths["data/migrate"]
            Rails.application.paths["data/migrate"].to_a
          end
        end
      end

      def migrate
        DataMigrate::DataMigrator.assure_data_schema_table
        target_version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
        if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 2
          DataMigrate::MigrationContext.new(migrations_paths).migrate(target_version)
        else
          paths = migrations_paths || "db/data/"
          DataMigrate::DataMigrator.migrate(paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
data_migrate-5.2.0 lib/data_migrate/tasks/data_migrate_tasks.rb
data_migrate-5.1.0 lib/data_migrate/tasks/data_migrate_tasks.rb
data_migrate-5.0.2 lib/data_migrate/tasks/data_migrate_tasks.rb
data_migrate-5.0.0 lib/data_migrate/tasks/data_migrate_tasks.rb
data_migrate-4.0.0 lib/data_migrate/tasks/data_migrate_tasks.rb