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.
This commit is contained in:
2025-12-18 13:59:14 +01:00
parent dd27cfe0e7
commit 0bc6d8226e

View File

@@ -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 (