Class: Duple::CLI::Copy

Inherits:
Thor::Group
  • Object
show all
Includes:
Helpers
Defined in:
lib/duple/cli/copy.rb

Overview

Usage:

duple copy

Options:

-c, [--config=CONFIG]         # The location of the config file.
-s, [--source=SOURCE]         # The name of the source environment.
-t, [--target=TARGET]         # The name of the target environment.
-g, [--group=GROUP]           # The group configuration to use when dumping source data.
    [--capture]               # Capture a new source snapshot before refreshing.
--dry-run, [--dry-run]        # Perform a dry run of the command. No data will be moved.
-t, [--tables=one two three]  # A list of tables to include when dumping source data.

Copies data from a source to a target database.

Instance Method Summary collapse

Methods included from Helpers

included

Instance Method Details

#dump_dataObject



34
35
36
# File 'lib/duple/cli/copy.rb', line 34

def dump_data
  postgres.pg_dump(dump_flags, data_file_path, source_db_config)
end

#require_included_tablesObject



28
29
30
31
32
# File 'lib/duple/cli/copy.rb', line 28

def require_included_tables
  unless config.included_tables.size > 0
    raise ArgumentError.new('One of --group or --tables options is required.')
  end
end

#restore_dataObject



38
39
40
# File 'lib/duple/cli/copy.rb', line 38

def restore_data
  postgres.pg_restore('-e -v --no-acl -O -a', data_file_path, target_db_config)
end