Sha256: 534fa8c9fa3cffde69ccb734259121ccbbb7143a615b078c31e5fd6420c57150
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
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}" : "" if stream.respond_to?(:external_encoding) && stream.external_encoding stream.puts "# encoding: #{stream.external_encoding.name}" end stream.puts "DataMigrate::Data.define(#{define_params})" stream end private def initialize(connection) @connection = connection all_versions = DataMigrate::DataSchemaMigration.all.map do |x| x.version.to_i end @version = begin all_versions.max rescue StandardError 0 end end end end
Version data entries
4 entries across 4 versions & 1 rubygems