Class: Sq::Dbsync::Database::Postgres
- Inherits:
-
Delegator
- Object
- Delegator
- Sq::Dbsync::Database::Postgres
- 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 collapse
- CASTS =
{ "text" => "varchar(255)", "character varying(255)" => "varchar(255)", # 255 is an arbitrary choice here. The one example we have # only has data 32 characters long in it. "character varying" => "varchar(255)", # Arbitrarily chosen precision. The default numeric type in mysql is # (10, 0), which is perhaps the most useless default I could imagine. "numeric" => "numeric(12,6)", "boolean" => "char(1)", # mysql has no single-column representation for timestamp with time zone "timestamp with time zone" => "datetime", "time without time zone" => "time", "timestamp without time zone" => "datetime", }
Constants included from Common
Instance Method Summary collapse
Methods included from Common
#__getobj__, #__setobj__, #ensure_connection, #extract_incrementally_to_file, #extract_to_file, #initialize, #inspect, #name, #source?
Instance Method Details
#hash_schema(plan) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sq/dbsync/database/postgres.rb', line 36 def hash_schema(plan) type_casts = plan.type_casts || {} ensure_connection table_name = source? ? plan.source_table_name : plan.table_name result = schema(table_name).each do |col, | [:source_db_type] ||= [:db_type] [:db_type] = cast_psql_to_mysql( [:db_type], type_casts[col.to_s] ) end Hash[result] end |
#set_lock_timeout(seconds) ⇒ Object
32 33 34 |
# File 'lib/sq/dbsync/database/postgres.rb', line 32 def set_lock_timeout(seconds) # Unimplemented end |