Skip to content

An open-source, faster Devin alternative

TypeScript

chore(webhooks): migration 050 drops the retired CP webhook tables (#32)

Igor Zalutskifb3b5970eb87
diff --git a/internal/db/migrations/050_webhooks_edge_cleanup.down.sql b/internal/db/migrations/050_webhooks_edge_cleanup.down.sql
new file mode 100644
index 00000000..115e11b6
--- /dev/null
+++ b/internal/db/migrations/050_webhooks_edge_cleanup.down.sql
@@ -0,0 +1,4 @@
+-- Irreversible cleanup: the dropped tables (webhook_destinations,
+-- webhook_deliveries, webhook_idempotency_keys) belonged to the retired CP-side
+-- webhook stack. Webhook management + delivery now live at the edge (Svix + D1),
+-- so there is nothing to restore here. To re-bootstrap, re-run migration 049.
diff --git a/internal/db/migrations/050_webhooks_edge_cleanup.up.sql b/internal/db/migrations/050_webhooks_edge_cleanup.up.sql
new file mode 100644
index 00000000..0b41db84
--- /dev/null
+++ b/internal/db/migrations/050_webhooks_edge_cleanup.up.sql
@@ -0,0 +1,7 @@
+-- All-Svix-at-edge: webhook destination management + delivery state moved to the
+-- edge (api-edge → Svix, D1 index). The CP keeps only sandbox_lifecycle_events as
+-- the transient outbox (relay → cell stream → edge). Drop the now-unused CP tables
+-- created by migration 049. See .agents/work/sandbox-webhooks-rearchitecture.md.
+DROP TABLE IF EXISTS webhook_deliveries CASCADE;
+DROP TABLE IF EXISTS webhook_idempotency_keys CASCADE;
+DROP TABLE IF EXISTS webhook_destinations CASCADE;
diff --git a/internal/db/store.go b/internal/db/store.go
index 5f8a8fb6..3075b78c 100644
--- a/internal/db/store.go
+++ b/internal/db/store.go
@@ -197,6 +197,7 @@ func (s *Store) Migrate(ctx context.Context) error {
{47, "migrations/047_orgs_billing_provider.up.sql"},
{48, "migrations/048_orgs_usage_sync_watermark.up.sql"},
{49, "migrations/049_sandbox_webhooks.up.sql"},
+ {50, "migrations/050_webhooks_edge_cleanup.up.sql"},
}
for _, m := range migrations {