From 5097267fb1f2ecc1a70226a38dda1581eae404a0 Mon Sep 17 00:00:00 2001 From: scanash00 Date: Sun, 18 Jan 2026 19:07:06 -0900 Subject: [PATCH] Update `cursors.last_cursor` column to `BIGINT` and add PostgreSQL migration for type alteration. --- backend/internal/db/db.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/internal/db/db.go b/backend/internal/db/db.go index 8c9fe11..713991b 100644 --- a/backend/internal/db/db.go +++ b/backend/internal/db/db.go @@ -320,7 +320,7 @@ func (db *DB) Migrate() error { db.Exec(`CREATE TABLE IF NOT EXISTS cursors ( id TEXT PRIMARY KEY, - last_cursor INTEGER NOT NULL, + last_cursor BIGINT NOT NULL, updated_at ` + dateType + ` NOT NULL )`) @@ -373,6 +373,10 @@ func (db *DB) runMigrations() { db.Exec(`UPDATE annotations SET body_value = text WHERE body_value IS NULL AND text IS NOT NULL`) db.Exec(`UPDATE annotations SET target_title = title WHERE target_title IS NULL AND title IS NOT NULL`) db.Exec(`UPDATE annotations SET motivation = 'commenting' WHERE motivation IS NULL`) + + if db.driver == "postgres" { + db.Exec(`ALTER TABLE cursors ALTER COLUMN last_cursor TYPE BIGINT`) + } } func (db *DB) Close() error { -- 2.51.2