Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

Add index on "user".created_at (#4063)

LinYushen99afb82c5086
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 0000000000..ac166d2b1f
--- /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 0000000000..76869a466e
--- /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);