Class: Sq::Dbsync::Database::Postgres

Inherits:
Delegator
  • Object
show all
Includes:
Common
Defined in:
lib/sq/dbsync/database/postgres.rb

Overview

Decorator around a Sequel database object, providing some non-standard extensions required for effective extraction from Postgres.

Constant Summary

Constants included from Common

Common::SQD

Instance Method Summary collapse

Methods included from Common

#__getobj__, #__setobj__, #ensure_connection, #extract_incrementally_to_file, #extract_to_file, #name

Constructor Details

#initialize(db) ⇒ Postgres

Returns a new instance of Postgres.



14
15
16
17
# File 'lib/sq/dbsync/database/postgres.rb', line 14

def initialize(db)
  super
  @db = db
end

Instance Method Details

#hash_schema(table_name) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/sq/dbsync/database/postgres.rb', line 25

def hash_schema(table_name)
  ensure_connection

  result = schema(table_name).each do |col, |
    [:source_db_type] ||= [:db_type]
    [:db_type] = psql_to_mysql_conversion([:db_type])
  end

  Hash[result]
end

#inspectObject



19
# File 'lib/sq/dbsync/database/postgres.rb', line 19

def inspect; "#<Database::Postgres #{opts[:database]}>"; end

#set_lock_timeout(seconds) ⇒ Object



21
22
23
# File 'lib/sq/dbsync/database/postgres.rb', line 21

def set_lock_timeout(seconds)
  # Unimplemented
end