dbbackup

package
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package dbbackup creates a plain-SQL pg_dump of the OpenWatch database, used as the pre-upgrade restore point before migrations run.

The cardinal rule: connection parameters (especially the password) go to pg_dump via PG* environment variables, NEVER on the command line — so the password never appears in the process argv (visible in `ps`). This mirrors how the rest of the codebase keeps credentials out of argv.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(dsn, outPath string) (*exec.Cmd, error)

Command builds the pg_dump command writing a plain-SQL dump to outPath. Connection parameters live in cmd.Env (PG*), NONE in cmd.Args — the tests pin that the password never reaches argv.

func DumpFileName

func DumpFileName(version, stamp string) string

DumpFileName returns the backup filename for a dump taken at stamp (an already-formatted timestamp, e.g. "20260616T010203Z") for version. Pure, so the caller owns the clock and tests are deterministic.

func Run

func Run(ctx context.Context, dsn, dir, version, stamp string) (string, error)

Run writes a dump to dir (created if absent) and returns the file path. The caller supplies version + stamp for the filename.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL