Skip to content

chore(db): drop redundant idx_webhook_on_workflow_id_block_id index#4809

Merged
waleedlatif1 merged 1 commit into
stagingfrom
waleedlatif1/redundant-webhook-index
May 30, 2026
Merged

chore(db): drop redundant idx_webhook_on_workflow_id_block_id index#4809
waleedlatif1 merged 1 commit into
stagingfrom
waleedlatif1/redundant-webhook-index

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Drops the redundant idx_webhook_on_workflow_id_block_id index on webhook
  • Its columns (workflow_id, block_id) are a left-prefix of idx_webhook_on_workflow_id_block_id_updated_at_desc (workflow_id, block_id, updated_at DESC), which fully serves the same queries
  • The dropped index is non-unique and enforces no constraint, so removal is safe — frees storage/memory and reduces write amplification on webhook inserts/updates
  • Resolves PlanetScale schema recommendation [REQUEST] Discord Webhook #114

Type of Change

  • Chore / maintenance

Testing

Migration generated via drizzle-kit; produces a single DROP INDEX statement. Recommend testing on a non-production branch first per PlanetScale guidance.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Removed because (workflow_id, block_id) is a left-prefix of idx_webhook_on_workflow_id_block_id_updated_at_desc, which fully covers it. The dropped index was non-unique and enforced no constraint.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 30, 2026 3:29am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 30, 2026

PR Summary

Low Risk
Single DROP INDEX on a redundant non-unique index; query plans should still use the remaining composite index.

Overview
Removes the redundant btree index idx_webhook_on_workflow_id_block_id on webhook via migration 0221_secret_hannibal_king.sql.

Lookups on (workflow_id, block_id) remain covered by idx_webhook_on_workflow_id_block_id_updated_at_desc from migration 0211, whose leading columns are the same prefix. The dropped index was non-unique, so this is a storage and write-amplification cleanup with no constraint impact.

Reviewed by Cursor Bugbot for commit 4bf0c6c. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR removes the redundant idx_webhook_on_workflow_id_block_id index on the webhook table, whose columns (workflow_id, block_id) are a strict left-prefix of the already-existing idx_webhook_on_workflow_id_block_id_updated_at_desc index (workflow_id, block_id, updated_at DESC). The change is a pure storage/write-amplification optimisation with no functional impact.

  • Drops the two-column index via a single DROP INDEX in migration 0221_secret_hannibal_king.sql, removes its Drizzle definition from schema.ts, and updates the Drizzle snapshot/journal accordingly.
  • The covering index created in migration 0211 already handles all query patterns the dropped index served, so no query regressions are expected.

Confidence Score: 5/5

Safe to merge — drops a non-unique, non-constraint index whose columns are fully covered by an existing wider index, with no functional impact on queries.

The migration is a single DROP INDEX on an index that is a strict left-prefix of an already-present three-column index. The schema, snapshot, and journal are all mutually consistent. No constraints, uniqueness guarantees, or query paths are affected.

No files require special attention.

Important Files Changed

Filename Overview
packages/db/migrations/0221_secret_hannibal_king.sql Single-statement migration that drops the redundant idx_webhook_on_workflow_id_block_id index; correct and complete.
packages/db/schema.ts Removes the workflowBlockIdx definition from the webhook table extras; remaining indexes are consistent with the migration and snapshot.
packages/db/migrations/meta/_journal.json Correctly appends migration 0221_secret_hannibal_king at idx 221, sequential with the previous entry.
packages/db/migrations/meta/0221_snapshot.json Snapshot no longer contains idx_webhook_on_workflow_id_block_id; idx_webhook_on_workflow_id_block_id_updated_at_desc is still present — consistent with schema.ts.

Reviews (1): Last reviewed commit: "chore(db): drop redundant idx_webhook_on..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 75d9873 into staging May 30, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/redundant-webhook-index branch May 30, 2026 03:31
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