Skip to content

Commit 3bb19ba

Browse files
jirhikerclaude
andcommitted
fix(ci): keep nightly pg_cron job production-only
Staging refreshes the materialized views on each deploy (the existing "Refresh materialized views" CD step), so it does not need the nightly pg_cron job. Drop ENABLE_PG_CRON from CD_staging.yml; only production registers the cron job. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 5ad3f25 commit 3bb19ba

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

.github/workflows/CD_staging.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ jobs:
5555
CLOUD_SQL_DATABASE: "${{ vars.CLOUD_SQL_DATABASE }}"
5656
CLOUD_SQL_USER: "${{ secrets.CLOUD_SQL_USER }}"
5757
CLOUD_SQL_IAM_AUTH: true
58-
# Register the nightly pg_cron materialized-view refresh job.
59-
# Requires the Cloud SQL instance flag cloudsql.enable_pg_cron=on and
60-
# cron.database_name set to CLOUD_SQL_DATABASE. See
61-
# docs/pg_cron-nightly-refresh.md.
62-
ENABLE_PG_CRON: "1"
6358
run: |
6459
uv run --no-dev alembic upgrade head
6560

docs/pg_cron-nightly-refresh.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ Postgres image (`postgis/postgis:17-3.5`) does not do. Running
3636

3737
So the migration is a **no-op unless `ENABLE_PG_CRON` is truthy**:
3838

39-
- Development, test, CI: `ENABLE_PG_CRON` unset → migration prints a skip
40-
message and records itself as applied. `alembic upgrade head` works on the
41-
stock dev image with nothing extra installed.
39+
- Development, test, CI, **and staging**: `ENABLE_PG_CRON` unset → migration
40+
prints a skip message and records itself as applied. `alembic upgrade head`
41+
works on the stock dev image with nothing extra installed. Staging refreshes
42+
the views on each deploy instead (the "Refresh materialized views" CD step),
43+
so it does not need the nightly job.
4244
- Production: `ENABLE_PG_CRON=1` → migration creates the extension, the helper
43-
function, and the cron job.
45+
function, and the cron job. Only `CD_production.yml` sets this.
4446

4547
## Production setup
4648

0 commit comments

Comments
 (0)