save checkpoint

This commit is contained in:
master
2026-02-11 01:32:14 +02:00
parent 5593212b41
commit cf5b72974f
2316 changed files with 68799 additions and 3808 deletions

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ -z "${PG_DSN:-}" ]]; then
echo "PG_DSN is required (PostgreSQL connection string)." >&2
exit 1
fi
RETAIN_MONTHS="${1:-12}"
DRY_RUN="${2:-true}"
if ! [[ "${RETAIN_MONTHS}" =~ ^[0-9]+$ ]]; then
echo "retainMonths must be a positive integer." >&2
exit 1
fi
if [[ "${RETAIN_MONTHS}" -lt 1 ]]; then
echo "retainMonths must be >= 1." >&2
exit 1
fi
case "${DRY_RUN}" in
true|false) ;;
*)
echo "dryRun must be 'true' or 'false'." >&2
exit 1
;;
esac
psql "${PG_DSN}" \
--no-psqlrc \
--set ON_ERROR_STOP=on \
--quiet \
--command "SELECT partition_name, dropped FROM scanner.drop_artifact_boms_partitions_older_than(${RETAIN_MONTHS}, ${DRY_RUN});"