Skip to content

Commit 39cadd8

Browse files
feat: PostgreSQL: add -O parameter to the list
1 parent fe0542e commit 39cadd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/dump/postgres.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ func (p *PostgresDumper) Dump(dbName string, dumpFilename string) error {
6363
// `-p` -> database server port number
6464
// `-U` -> connect as specified database user
6565
// `-d` -> database to dump
66+
// `-O` -> prevents `ALTER OWNER` commands in the dump file.
6667
// `-f` -> output file or directory name
6768
// `-F c` -> output file format (custom, directory, tar, plain text(default)). We are using the custom format here.
6869
// `-c` -> clean(drop) database objects before recreating
69-
cmd := exec.Command("pg_dump", "-h", p.host, "-p", fmt.Sprintf("%d", p.port), "-U", p.user, "-d", dbName, "-f", dumpFilename, "-F", "c", "-c")
70+
cmd := exec.Command("pg_dump", "-h", p.host, "-p", fmt.Sprintf("%d", p.port), "-U", p.user, "-d", dbName, "-f", dumpFilename, "-O", "-F", "c", "-c")
7071
var stderr bytes.Buffer
7172
cmd.Stderr = &stderr
7273

0 commit comments

Comments
 (0)