refactor: extract gumbo schema migration to ArgoCD PreSync job

This commit is contained in:
Antigravity 2026-05-21 16:33:24 -04:00
parent 75c95d6bb1
commit 1bb17e204a
3 changed files with 37 additions and 11 deletions

View File

@ -23,17 +23,7 @@ async def persist_gumbo_summary(payload: dict[str, Any]) -> None:
conn = await psycopg.AsyncConnection.connect(dsn) conn = await psycopg.AsyncConnection.connect(dsn)
try: try:
async with conn.cursor() as cur: async with conn.cursor() as cur:
await cur.execute(
"""
CREATE TABLE IF NOT EXISTS gumbo_summaries (
id bigserial PRIMARY KEY,
workflow_id text NOT NULL,
object_key text NOT NULL,
summary text NOT NULL,
created_at timestamptz NOT NULL DEFAULT now()
);
"""
)
await cur.execute( await cur.execute(
""" """
INSERT INTO gumbo_summaries (workflow_id, object_key, summary) INSERT INTO gumbo_summaries (workflow_id, object_key, summary)

View File

@ -0,0 +1,35 @@
apiVersion: batch/v1
kind: Job
metadata:
name: gumbo-schema-init
namespace: ai-agents-gumbo
annotations:
argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/hook-delete-policy: HookSucceeded
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: schema-init
image: postgres:16-alpine
command:
- sh
- -c
- |
psql "$PGURL" -c "
CREATE TABLE IF NOT EXISTS gumbo_summaries (
id bigserial PRIMARY KEY,
workflow_id text NOT NULL,
object_key text NOT NULL,
summary text NOT NULL,
created_at timestamptz NOT NULL DEFAULT now()
);"
env:
- name: PGURL
valueFrom:
secretKeyRef:
name: gumbo-results-db
key: dsn
- name: PGDATABASE
value: gumbo

View File

@ -4,3 +4,4 @@ resources:
- gumbo-externalsecrets.yaml - gumbo-externalsecrets.yaml
- gumbo-job-template.yaml - gumbo-job-template.yaml
- static-demo.yaml - static-demo.yaml
- gumbo-schema-init.yaml