From 0bc6d8226e3a9f8fad61ab857579b036cf309a4f Mon Sep 17 00:00:00 2001 From: robin Date: Thu, 18 Dec 2025 13:59:14 +0100 Subject: [PATCH] fix: remove problematic DATE() index from api_usage table PostgreSQL requires functions in indexes to be marked IMMUTABLE. Removed idx_api_usage_user_date composite index that used DATE(). Remaining indexes (user_id, api_type, created_at) still provide good query performance for daily limit checks. --- supa_schema.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/supa_schema.sql b/supa_schema.sql index e891327..fe502a7 100644 --- a/supa_schema.sql +++ b/supa_schema.sql @@ -248,7 +248,6 @@ CREATE TABLE IF NOT EXISTS api_usage ( CREATE INDEX idx_api_usage_user_id ON api_usage(user_id); CREATE INDEX idx_api_usage_api_type ON api_usage(api_type); CREATE INDEX idx_api_usage_created_at ON api_usage(created_at); -CREATE INDEX idx_api_usage_user_date ON api_usage(user_id, DATE(created_at)); -- User credits table (for future credits system) CREATE TABLE IF NOT EXISTS user_credits (