diff options
| author | OsCoder <oscoder@lczimmermann.eu> | 2026-09-11 15:48:53 +0200 |
|---|---|---|
| committer | OsCoder <oscoder@lczimmermann.eu> | 2026-09-11 15:48:53 +0200 |
| commit | 962d2097adde8f690ef9768231122ede732a3681 (patch) | |
| tree | 556d075efbc6ad06378775a02e86391920ea6244 /scripts | |
| download | postgres_browser-962d2097adde8f690ef9768231122ede732a3681.tar.xz postgres_browser-962d2097adde8f690ef9768231122ede732a3681.zip | |
Initial Commit with podman scripts
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/insert-test-data.sh | 6 | ||||
| -rwxr-xr-x | scripts/start-db.sh | 16 | ||||
| -rwxr-xr-x | scripts/stop-db.sh | 3 |
3 files changed, 25 insertions, 0 deletions
diff --git a/scripts/insert-test-data.sh b/scripts/insert-test-data.sh new file mode 100755 index 0000000..b817cce --- /dev/null +++ b/scripts/insert-test-data.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +podman exec -it pg-postgres-browser psql -U postgres -d testdb -c \ + "CREATE TABLE clients (id serial PRIMARY KEY, label text, city text); + INSERT INTO clients (label, city) VALUES ('Anna Schmidt', 'Kiel'), ('Ben Weber', 'Flensburg');"
\ No newline at end of file diff --git a/scripts/start-db.sh b/scripts/start-db.sh new file mode 100755 index 0000000..d46e5f5 --- /dev/null +++ b/scripts/start-db.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +CONTAINER_NAME="pg-postgres-browser" + +if podman ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then + echo "Container existiert bereits, starte neu..." + podman start "${CONTAINER_NAME}" +else + echo "Erstelle neuen Container..." + podman run -d --name "${CONTAINER_NAME}" \ + -e POSTGRES_PASSWORD=test \ + -e POSTGRES_DB=testdb \ + -p 5432:5432 \ + postgres:latest +fi
\ No newline at end of file diff --git a/scripts/stop-db.sh b/scripts/stop-db.sh new file mode 100755 index 0000000..1c6b0af --- /dev/null +++ b/scripts/stop-db.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +podman stop pg-postgres-browser
\ No newline at end of file |
