Class: DataMigrate::SchemaDumper

Inherits:
Object
  • Object
show all
Defined in:
lib/data_migrate/schema_dumper.rb

Overview

Provides the capability to write the current data schema version to the data_schema file Based on ActiveRecord::SchemaDumper

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dump(connection = ActiveRecord::Base.connection, stream = $stdout) ⇒ Object



11
12
13
14
# File 'lib/data_migrate/schema_dumper.rb', line 11

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

Instance Method Details

#dump(stream) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/data_migrate/schema_dumper.rb', line 17

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

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

  stream
end