From 827c65c707cc6d04d3247e053fc4be5d6ebc236a Mon Sep 17 00:00:00 2001 From: userAdityaa Date: Wed, 22 Apr 2026 18:02:00 +0545 Subject: [PATCH] feat: add missing SQLite indexes for billing and API hot-path queries --- backend/migrations/0002_hot_path_indexes.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 backend/migrations/0002_hot_path_indexes.sql diff --git a/backend/migrations/0002_hot_path_indexes.sql b/backend/migrations/0002_hot_path_indexes.sql new file mode 100644 index 0000000..6872757 --- /dev/null +++ b/backend/migrations/0002_hot_path_indexes.sql @@ -0,0 +1,11 @@ +CREATE INDEX IF NOT EXISTS idx_tenant_stripe_customer_id +ON tenant (stripe_customer_id); + +CREATE INDEX IF NOT EXISTS idx_relay_tenant_id +ON relay (tenant, id); + +CREATE INDEX IF NOT EXISTS idx_relay_tenant_status_plan +ON relay (tenant, status, plan); + +CREATE INDEX IF NOT EXISTS idx_activity_resource_type_resource_id_created_at_id +ON activity (resource_type, resource_id, created_at DESC, id DESC); -- 2.52.0