-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ dist-ssr | |
*.sw? | ||
ngrok | ||
.dev.vars | ||
|
||
dumper/dump.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
confirm() { | ||
read -r -p "${1:-Are you sure? [y/N]} " response | ||
if [ "$response" != "y" ]; then | ||
echo "Operation cancelled." | ||
exit 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: '3.8' | ||
services: | ||
postgres: | ||
image: postgres:15.1 | ||
environment: | ||
POSTGRES_PASSWORD: example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
SCRIPT_DIR="$(dirname "$0")" | ||
|
||
source "$SCRIPT_DIR/confirm.sh" | ||
|
||
confirm "Are you sure you want to create a prod dump? [y/N]" | ||
|
||
export $(cat "$SCRIPT_DIR/../.dev.vars" | xargs) | ||
|
||
docker-compose exec postgres pg_dump postgresql://postgres:$DB_PASS@$DB_HOST:5432/$DB_NAME > "$SCRIPT_DIR/dump.sql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
SCRIPT_DIR="$(dirname "$0")" | ||
|
||
source "$SCRIPT_DIR/confirm.sh" | ||
|
||
if [ ! -f "$SCRIPT_DIR/dump.sql" ]; then | ||
echo "Error: dump.sql does not exist." | ||
exit 1 | ||
fi | ||
|
||
export $(cat "$SCRIPT_DIR/../.dev.vars" | xargs) | ||
|
||
confirm "Are you sure you want to execute the psql command? [y/N]" | ||
|
||
docker-compose exec postgres psql postgresql://postgres:$DB_PASS@$DB_HOST:5432/$DB_NAME < "$SCRIPT_DIR/dump.sql" | ||
|