fix(server): session updated at (#13099)

fix AI-325

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Improved database handling for session update times to ensure more
accurate tracking of session activity.
* Enhanced migration process to better manage and update session
metadata.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2025-07-08 21:16:56 +08:00
committed by GitHub
parent 072fff1460
commit 0bd1f10498
3 changed files with 40 additions and 1 deletions
@@ -1,5 +1,9 @@
-- AlterTable
ALTER TABLE "ai_sessions_metadata" ADD COLUMN "updated_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE ai_sessions_metadata ADD COLUMN updated_at TIMESTAMPTZ(3);
UPDATE ai_sessions_metadata SET updated_at = created_at;
ALTER TABLE ai_sessions_metadata ALTER COLUMN updated_at SET NOT NULL, ALTER COLUMN updated_at SET DEFAULT CURRENT_TIMESTAMP;
-- DropIndex
DROP INDEX IF EXISTS "ai_session_unique_doc_session_idx";