fix(deploy): use shell-safe migration history values #107

Merged
m merged 2 commits from codex/wp-203-admission-runtime into main 2026-08-22 11:54:56 +00:00
3 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -37,7 +37,7 @@ if [[ -n "${MIGRATION_BASELINE:-}" ]]; then
migration_id="$(basename "$file" .sql)"
number="${migration_id:0:3}"
if (( 10#$number <= 10#$MIGRATION_BASELINE )); then
psql_exec -v migration_id="$migration_id" -v applied_at="$now_ms" -c "INSERT INTO public.assistant_migration_history(migration_id, applied_at_unix_millis) VALUES (:'migration_id', :'applied_at') ON CONFLICT (migration_id) DO NOTHING;"
psql_exec -c "INSERT INTO public.assistant_migration_history(migration_id, applied_at_unix_millis) VALUES ('$migration_id', $now_ms) ON CONFLICT (migration_id) DO NOTHING;"
fi
done
fi
@@ -45,9 +45,9 @@ fi
for file in "$REPO_DIR"/database/migrations/[0-9][0-9][0-9]_*.sql; do
[[ -f "$file" ]] || continue
migration_id="$(basename "$file" .sql)"
applied="$(psql_exec -At -v migration_id="$migration_id" -c "SELECT 1 FROM public.assistant_migration_history WHERE migration_id=:'migration_id' LIMIT 1;")"
applied="$(psql_exec -At -c "SELECT 1 FROM public.assistant_migration_history WHERE migration_id='$migration_id' LIMIT 1;")"
[[ "$applied" == "1" ]] && continue
psql_exec < "$file"
now_ms="$(date +%s%3N)"
psql_exec -v migration_id="$migration_id" -v applied_at="$now_ms" -c "INSERT INTO public.assistant_migration_history(migration_id, applied_at_unix_millis) VALUES (:'migration_id', :'applied_at');"
psql_exec -c "INSERT INTO public.assistant_migration_history(migration_id, applied_at_unix_millis) VALUES ('$migration_id', $now_ms);"
done
+1 -1
View File
@@ -1,5 +1,5 @@
{
"task_file": "dev/tasks/DEV-000115-cognitive-admission-control.json",
"task_id": "DEV-000115",
"task_revision": 5
"task_revision": 6
}
@@ -1,6 +1,6 @@
{
"task_id": "DEV-000115",
"task_revision": 5,
"task_revision": 6,
"architecture_revision": "ADR-0018",
"base_repo_revision": "9b26260",
"risk_tier": "E",