Skip to content

Added table specification to pg_dump #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ RUN apk update \

COPY main.go /app/main.go

RUN go mod init github.com/itbm/postgresql-backup-s3 \
RUN go mod init github.com/guy1998/postgresql-backup-s3 \
&& go get github.com/robfig/cron/v3 \
&& go build -o out/go-cron

FROM alpine:3.22
LABEL maintainer="ITBM"
LABEL maintainer="guy1998"

RUN apk update \
&& apk upgrade \
Expand Down Expand Up @@ -45,6 +45,7 @@ ENV USE_CUSTOM_FORMAT no
ENV COMPRESSION_CMD 'gzip'
ENV DECOMPRESSION_CMD 'gunzip -c'
ENV PARALLEL_JOBS 1
ENV TABLES **None**

ADD run.sh run.sh
ADD backup.sh backup.sh
Expand Down
3 changes: 3 additions & 0 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ if [ "$USE_CUSTOM_FORMAT" = "yes" ]; then
if [ "${POSTGRES_DATABASE}" == "all" ]; then
echo "ERROR: Custom format (-Fc) is not supported with pg_dumpall."
exit 1
elif [ -n "$TABLES" ]; then
echo "Dumping specific tables in custom format: $TABLES"
pg_dump -Fc $POSTGRES_HOST_OPTS -d "$POSTGRES_DATABASE" $(for table in $TABLES; do echo -n "-t $table "; done) > "$SRC_FILE"
else
pg_dump -Fc $POSTGRES_HOST_OPTS $POSTGRES_DATABASE > $SRC_FILE
fi
Expand Down