Class: Masker::Adapters::Postgres

Inherits:
Object
  • Object
show all
Defined in:
lib/masker/adapters/postgres.rb

Instance Method Summary collapse

Constructor Details

#initialize(database_url, config_path, logger, opts = {}) ⇒ Postgres

Returns a new instance of Postgres.



4
5
6
7
8
# File 'lib/masker/adapters/postgres.rb', line 4

def initialize(database_url, config_path, logger, opts = {})
  @conn = PG.connect(database_url)
  @config = Configurations::Postgres.new(conn, config_path, logger, opts)
  @logger = logger
end

Instance Method Details

#maskObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/masker/adapters/postgres.rb', line 10

def mask
  remove_temp_tables
  config.remove_missing_tables
  config.remove_missing_columns
  create_temp_tables
  insert_fake_data_into_temp_tables
  merge_tables
  truncate
ensure
  remove_temp_tables
end