Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FIX (tooling): Pass the goose connection through the environment, so just test migrates the worker slots once .env is exported

Rostislav Dugin7c3605c4bd26
diff --git a/AGENTS.md b/AGENTS.md
index 99881aee..40ea301e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -39,7 +39,7 @@ Work happens on a Fedora host; any other host distro is on its own. Tool version
| `just lint` | Check every module without changing files |
| `just format` | Format every module |
| `goose -dir backend/migrations create <name> sql` | Create a migration |
-| `goose -dir backend/migrations postgres "$GOOSE_DBSTRING" up` (or `down`) | Apply or roll back migrations on the dev database |
+| `goose -dir backend/migrations up` (or `down`), with `.env` exported | Apply or roll back migrations on the dev database; goose reads `GOOSE_DRIVER` and `GOOSE_DBSTRING` from the environment |
| `swag init -d . -g cmd/main.go -o swagger`, run in `backend/` | Regenerate the API docs |
### Several agents, one set of containers
diff --git a/backend/README.md b/backend/README.md
index 7daa297d..fa0c34e4 100644
--- a/backend/README.md
+++ b/backend/README.md
@@ -24,11 +24,11 @@ The backend applies pending migrations on startup. To create a migration:
> goose -dir backend/migrations create MIGRATION_NAME sql
-To apply or roll back migrations on the dev database:
+To apply or roll back migrations on the dev database, with the variables from `.env` exported (goose reads `GOOSE_DRIVER` and `GOOSE_DBSTRING` from the environment):
-> goose -dir backend/migrations postgres "$GOOSE_DBSTRING" up
+> goose -dir backend/migrations up
-> goose -dir backend/migrations postgres "$GOOSE_DBSTRING" down
+> goose -dir backend/migrations down
# Swagger
diff --git a/scripts/test.sh b/scripts/test.sh
index 8f7e13b8..714056e7 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -50,7 +50,7 @@ TEST_PARALLEL_WORKERS=$workers go run ./cmd/cleanup_test_db
for ((i = 0; i < workers; i++)); do
dbstring=$(sed -E "s#/([^/?]+)\?#/\1_w$i?#" <<<"$GOOSE_TEST_DBSTRING")
echo "migrating slot $i"
- goose -dir ./migrations postgres "$dbstring" up
+ GOOSE_DRIVER=postgres GOOSE_DBSTRING="$dbstring" goose -dir ./migrations up
done
TESTCONTAINERS_RYUK_DISABLED=true TEST_PARALLEL_WORKERS=$workers \