Skip to content

fix: make 0218 event_routes migration idempotent#956

Closed
dylanjeffers wants to merge 3 commits into
mainfrom
fix/migration-0218-idempotent
Closed

fix: make 0218 event_routes migration idempotent#956
dylanjeffers wants to merge 3 commits into
mainfrom
fix/migration-0218-idempotent

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

The ALTER TABLE ADD CONSTRAINT was not guarded, causing bridge migrate to fail when the table already exists. Inlines PRIMARY KEY into CREATE TABLE IF NOT EXISTS so re-runs are safe. This was blocking all auto-upgrades since June 10.

dylanjeffers and others added 3 commits June 15, 2026 18:36
…et auth

The handler was using getAuthedWallet(c) which required signature-based
auth, then updating by wallet address. This was overcomplicated for a
fire-and-forget activity signal. Now uses myId from the user_id query
param (already decoded by resolveMyIdMiddleware) and updates by user_id.

Removes requireAuthMiddleware from the route since the handler no longer
needs the wallet — the global authMiddleware still validates signatures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers the three key paths:
- Authenticated request with valid user_id returns 200
- Missing user_id returns 400
- Unauthenticated request with user_id returns 403

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CREATE TABLE IF NOT EXISTS silently skips if the table already exists,
but the subsequent ALTER TABLE ADD CONSTRAINT had no guard — causing:

  ERROR: multiple primary keys for table "event_routes" are not allowed

on any DB where the table was already created.  Fix by inlining the
PRIMARY KEY constraint in the CREATE TABLE definition so the whole
statement is skipped under IF NOT EXISTS.

This has been blocking bridge auto-upgrades since the 0218 migration
was first applied to production (June 9).  All migrate-* jobs in the
api namespace have been failing, leaving 60+ auto-upgrader CronJob
pods stuck in a 30-min kubectl-wait loop.
@dylanjeffers

Copy link
Copy Markdown
Contributor Author

Re-opening against main with cherry-pick to isolate only the migration fix — dropping ping feature code that was carried along from the branch tip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant