fix: pre-create index on partitioned table to unblock dev setup (#325)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Taylor Ho
2026-04-15 08:44:30 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent c236287977
commit e7652c8a56
+8
View File
@@ -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