Save a copy of your database in a plain text format. This saves all the SQL code to recreate the structure and data.

psql_backup(
  path = "dump_db.sql",
  config_path = getOption("psql.config_path", NULL),
  config_value = getOption("psql.config_value", "default")
)

Arguments

path

A string of the file path to save the dumped database

config_path

A string of a file path to the yaml configuration file. The default value grabs the file path from the psql.config_path option and uses NULL if no value supplied.

config_value

A string of the name of value. The default value grabs the value from the psql.config_value option and uses "default" if no value is supplied.

Value

TRUE (or errors)

Details

This function requires the user has psql installed on their machine.Go to postgres for download instructions.

Password protected databases require an extra step. A .pgpass file needs to be created so you the password can be passed to the function. The function will check if you have a password present in your config file it will require you to have a .pgpass file in your home directory.

Examples

if (FALSE) { # \dontrun{
psql_backup("/Users/user1/Dumps/dump_db.sql")
} # }