From e7652c8a56b7504e7c109fc6032f2668bebb6060 Mon Sep 17 00:00:00 2001 From: Taylor Ho Date: Wed, 15 Apr 2026 05:44:30 -1000 Subject: [PATCH] fix: pre-create index on partitioned table to unblock dev setup (#325) Co-authored-by: Claude Opus 4.6 (1M context) --- scripts/dev-setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/dev-setup.sh b/scripts/dev-setup.sh index 005308ba9..61a33adb4 100755 --- a/scripts/dev-setup.sh +++ b/scripts/dev-setup.sh @@ -130,6 +130,14 @@ if [[ ! -f "${SCHEMA_FILE}" ]]; then warn "No schema.sql found at ${SCHEMA_FILE}. Skipping." else if [[ -x "${PGSCHEMA}" ]]; then + # pgschema uses CREATE INDEX CONCURRENTLY for new indexes, which Postgres + # does not support on partitioned tables. Pre-create any such indexes here + # so pgschema sees them as already existing and skips the CONCURRENTLY path. + log "Pre-creating indexes on partitioned tables (if needed)..." + docker exec sprout-postgres psql -U "${PGUSER}" -d "${PGDATABASE}" -q -c \ + "CREATE INDEX IF NOT EXISTS idx_events_parameterized ON events (kind, pubkey, d_tag, deleted_at) WHERE d_tag IS NOT NULL;" \ + 2>/dev/null || true + log "Using pgschema for migrations..." attempts=0 max_attempts=10