chore(infra): point migration helper preflight at 'codex migrate'

Now that 'codex migrate' applies the idempotent schema via a privileged role,
recommend it (with MIGRATION_DATABASE_URL) as the primary schema-sync fix in the
preflight abort message, keeping the manual owner-ALTER as a fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Tarik Moussa
2026-06-15 15:54:25 +02:00
parent cdb7d254df
commit 10ff5ba3ab

View File

@@ -76,11 +76,13 @@ PYEOF
)" )"
if [[ "$SECTION_OK" != "yes" ]]; then if [[ "$SECTION_OK" != "yes" ]]; then
echo "ABORT — schema not ready: chunks.section is missing (audit M-1)." echo "ABORT — schema not ready: chunks.section is missing (audit M-1)."
echo "The app user cannot add it (chunks is owned by 'postgres'). Apply it as" echo "The app user cannot add it (core tables are owned by 'postgres'). Sync the"
echo "the table owner, then re-run this script:" echo "schema with a privileged role, then re-run this script. Either:"
echo "" echo ""
echo " ssh alfred@192.168.178.103 \\" echo " (a) MIGRATION_DATABASE_URL=postgresql://postgres:PASS@HOST:PORT/papers \\"
echo " \"sudo -u postgres psql -d papers -c \\\\\"ALTER TABLE chunks ADD COLUMN IF NOT EXISTS section TEXT;\\\\\"\"" echo " \"$CODEX_DIR/.venv/bin/codex\" migrate # applies schema.sql idempotently"
echo " (b) sudo -u postgres psql -d papers \\"
echo " -c \"ALTER TABLE chunks ADD COLUMN IF NOT EXISTS section TEXT;\""
echo "" echo ""
echo "Nothing was changed — no TRUNCATE was issued." echo "Nothing was changed — no TRUNCATE was issued."
exit 1 exit 1