Class: Departure::DSN

Inherits:
Object
  • Object
show all
Defined in:
lib/departure/dsn.rb

Overview

Represents the ‘DSN’ argument of Percona’s pt-online-schema-change See www.percona.com/doc/percona-toolkit/2.0/pt-online-schema-change.html#dsn-options

Instance Method Summary collapse

Constructor Details

#initialize(database, table_name) ⇒ DSN

Constructor



9
10
11
12
13
# File 'lib/departure/dsn.rb', line 9

def initialize(database, table_name)
  @database = database
  @table_name = table_name
  @suffix = ENV.fetch('PERCONA_DSN_SUFFIX', nil)
end

Instance Method Details

#to_sObject

Returns the pt-online-schema-change DSN string. See www.percona.com/doc/percona-toolkit/2.0/pt-online-schema-change.html#dsn-options



17
18
19
# File 'lib/departure/dsn.rb', line 17

def to_s
  "D=#{database},t=#{table_name}#{suffix.nil? ? nil : ',' + suffix}"
end