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:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user