Skip to content

Commit

Permalink
Formatting change for the 2 backup commands
Browse files Browse the repository at this point in the history
  • Loading branch information
asteel-gsa committed Jun 4, 2024
1 parent 0636606 commit 2f627ae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/db_to_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func LocalDatabaseSync(
}

psql_write := pipes.Psql(
pipes.PG_Dump_Table(source_db_creds, schema, table),
pipes.PG_Dump_Table(source_db_creds, schema, table, "--format plain"),
dest_db_creds,
)
psql_write.Wait()
Expand Down Expand Up @@ -118,7 +118,7 @@ func CgovDatabaseSync(
}

psql_write := pipes.Psql(
pipes.PG_Dump_Table(source_db_creds, schema, table),
pipes.PG_Dump_Table(source_db_creds, schema, table, "--format plain"),
dest_db_creds,
)
psql_write.Wait()
Expand Down
4 changes: 2 additions & 2 deletions cmd/db_to_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func tables_to_local_bucket(
// 2. When there are no names in the list (backup all).
if slices.Contains(table_names, table) || BACKUP_ALL {
mc_pipe := pipes.McWrite(
pipes.PG_Dump_Table(source_creds, schema, table),
pipes.PG_Dump_Table(source_creds, schema, table, "--format c"),
up_creds,
fmt.Sprintf("%s%s/%s-%s.dump", s3path.Bucket, s3path.Key, schema, table),
)
Expand All @@ -102,7 +102,7 @@ func tables_to_cgov_bucket(
for table, schema := range table_to_schema {
if slices.Contains(table_names, table) || BACKUP_ALL {
s3_pipe := pipes.S3Write(
pipes.PG_Dump_Table(source_creds, schema, table),
pipes.PG_Dump_Table(source_creds, schema, table, "--format c"),
s3_creds,
fmt.Sprintf("%s%s/%s-%s.dump", s3path.Bucket, s3path.Key, schema, table),
)
Expand Down
5 changes: 3 additions & 2 deletions internal/pipes/pg_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import (

func PG_Dump_Table(creds vcap.Credentials,
schema string,
table string) *script.Pipe {
table string,
format string) *script.Pipe {
// Compose the command as a slice
cmd := []string{
util.PGDUMP_path,
"--no-password",
"--no-privileges",
"--no-owner",
"--format c",
format, // need plain for db_to_db
"--table",
fmt.Sprintf("%s.%s", schema, table),
"--dbname",
Expand Down

0 comments on commit 2f627ae

Please sign in to comment.