Sha256: 4ee2e3c1a4693cf878e99d02db919165bacb89d1034503709cfbb7328eb7710b

Contents?: true

Size: 874 Bytes

Versions: 17

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

module DataMigrate
  ##
  # Provides the capability to write the current data schema version to
  # the data_schema file Based on ActiveRecord::SchemaDumper
  class SchemaDumper
    private_class_method :new

    class << self
      def dump(connection = ActiveRecord::Base.connection, stream = $stdout)
        new(connection).dump(stream)
        stream
      end
    end

    def dump(stream)
      define_params = @version ? "version: #{@version}" : ""

      stream.puts "DataMigrate::Data.define(#{define_params})"

      stream
    end

    private

    def initialize(connection)
      @connection = connection
      all_versions =  DataSchemaMigration.normalized_versions

      @version = begin
                    all_versions.max
                  rescue StandardError
                    0
                  end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
data_migrate-9.1.3 lib/data_migrate/schema_dumper.rb
data_migrate-9.1.2 lib/data_migrate/schema_dumper.rb
data_migrate-9.1.1 lib/data_migrate/schema_dumper.rb
data_migrate-9.1.0 lib/data_migrate/schema_dumper.rb
data_migrate-10.0.3.rc lib/data_migrate/schema_dumper.rb
data_migrate-10.0.0.rc1 lib/data_migrate/schema_dumper.rb
data_migrate-9.0.0 lib/data_migrate/schema_dumper.rb
data_migrate-8.5.0 lib/data_migrate/schema_dumper.rb
data_migrate-8.4.2 lib/data_migrate/schema_dumper.rb
data_migrate-8.4.1 lib/data_migrate/schema_dumper.rb
data_migrate-8.4.0 lib/data_migrate/schema_dumper.rb
data_migrate-8.3.0 lib/data_migrate/schema_dumper.rb
data_migrate-8.2.0 lib/data_migrate/schema_dumper.rb
data_migrate-8.1.1 lib/data_migrate/schema_dumper.rb
data_migrate-8.1.0 lib/data_migrate/schema_dumper.rb
data_migrate-8.0.0 lib/data_migrate/schema_dumper.rb
data_migrate-8.0.0.rc2 lib/data_migrate/schema_dumper.rb