Class: Mysql2postgres::PostgresDbWriter

Inherits:
PostgresFileWriter show all
Defined in:
lib/mysql2postgres/postgres_db_writer.rb

Instance Attribute Summary collapse

Attributes inherited from PostgresWriter

#destination, #filename

Instance Method Summary collapse

Methods inherited from PostgresFileWriter

#close, #truncate, #write_constraints, #write_contents, #write_indexes, #write_table

Methods inherited from PostgresWriter

#column_description, #column_type, #column_type_info, #process_row, #truncate

Constructor Details

#initialize(file, destination) ⇒ PostgresDbWriter

Returns a new instance of PostgresDbWriter.



10
11
12
13
14
15
# File 'lib/mysql2postgres/postgres_db_writer.rb', line 10

def initialize(file, destination)
  # NOTE: the superclass opens and truncates filename for writing
  super

  @connection = Connection.new destination
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



8
9
10
# File 'lib/mysql2postgres/postgres_db_writer.rb', line 8

def connection
  @connection
end

Instance Method Details

#clear_schemaObject



21
22
23
# File 'lib/mysql2postgres/postgres_db_writer.rb', line 21

def clear_schema
  connection.clear_schema
end

#inload(path = filename) ⇒ Object



17
18
19
# File 'lib/mysql2postgres/postgres_db_writer.rb', line 17

def inload(path = filename)
  connection.load_file path
end