From cdab78584b564d4b973295d2e92d4b1576ff37da Mon Sep 17 00:00:00 2001 From: yushen Date: Fri, 12 Jun 2026 15:45:13 +0800 Subject: [PATCH] Add index on "user".created_at Adds migration 119 creating idx_user_created_at on "user"(created_at) using CREATE INDEX CONCURRENTLY, matching the repo convention for index-only migrations (114/115). Co-authored-by: multica-agent --- server/migrations/119_user_created_at_index.down.sql | 1 + server/migrations/119_user_created_at_index.up.sql | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 server/migrations/119_user_created_at_index.down.sql create mode 100644 server/migrations/119_user_created_at_index.up.sql diff --git a/server/migrations/119_user_created_at_index.down.sql b/server/migrations/119_user_created_at_index.down.sql new file mode 100644 index 000000000..ac166d2b1 --- /dev/null +++ b/server/migrations/119_user_created_at_index.down.sql @@ -0,0 +1 @@ +DROP INDEX CONCURRENTLY IF EXISTS idx_user_created_at; diff --git a/server/migrations/119_user_created_at_index.up.sql b/server/migrations/119_user_created_at_index.up.sql new file mode 100644 index 000000000..76869a466 --- /dev/null +++ b/server/migrations/119_user_created_at_index.up.sql @@ -0,0 +1,8 @@ +-- Index on "user".created_at to support ordering/filtering users by signup time. +-- +-- "user" is a reserved word so it stays double-quoted. The migration runner +-- executes files outside an explicit transaction, so CONCURRENTLY is kept in +-- its own single-statement migration to avoid Postgres' implicit transaction +-- block for multi-statement query strings. +CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_user_created_at + ON "user" (created_at);