From 77ec4f1466551b4639e48db4f635e4232de1879b Mon Sep 17 00:00:00 2001 From: J3vb <192430104+J3vb@users.noreply.github.com> Date: Sat, 18 Jul 2026 11:45:30 +0200 Subject: [PATCH] chore(db): commit stale sqlc output; make sqlc-verify honest db/queries/sqlite/events.sql was changed (typed CAST for GetMaxEventSeq) without re-running generation; commit the regenerated dbgen (interface{} -> int64, no callers depend on the old signature). Scope sqlc-verify's diff to db/dbgen: regeneration strips the hand-added //go:build postgres tags in db/pgdbgen, so verifying that tree can never pass; pgdbgen is scheduled for removal with the Postgres scaffolding. Co-Authored-By: Claude Fable 5 --- Server/Makefile | 7 ++++++- Server/db/dbgen/events.sql.go | 10 +++++----- Server/db/dbgen/querier.go | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Server/Makefile b/Server/Makefile index 788a2f46..54d2ca89 100644 --- a/Server/Makefile +++ b/Server/Makefile @@ -17,9 +17,14 @@ sqlc-install: sqlc-generate: sqlc generate +# Verify only db/dbgen: the committed db/pgdbgen files carry hand-added +# `//go:build postgres` tags that `sqlc generate` strips, so a pgdbgen diff +# is expected noise. pgdbgen is scheduled for removal with the Postgres +# scaffolding; restore it after generating so verify leaves a clean tree. sqlc-verify: sqlc generate - @git diff --exit-code db/dbgen db/pgdbgen || ( \ + @git checkout -- db/pgdbgen + @git diff --exit-code db/dbgen || ( \ echo "ERROR: generated sqlc output is stale. Run 'make sqlc-generate' and commit the result." ; \ exit 1 ; \ ) diff --git a/Server/db/dbgen/events.sql.go b/Server/db/dbgen/events.sql.go index fa6e0e29..06b346d8 100644 --- a/Server/db/dbgen/events.sql.go +++ b/Server/db/dbgen/events.sql.go @@ -61,14 +61,14 @@ func (q *Queries) GetEventsSince(ctx context.Context, arg GetEventsSinceParams) } const getMaxEventSeq = `-- name: GetMaxEventSeq :one -SELECT COALESCE(MAX(seq), 0) FROM events +SELECT CAST(COALESCE(MAX(seq), 0) AS INTEGER) AS max_seq FROM events ` -func (q *Queries) GetMaxEventSeq(ctx context.Context) (interface{}, error) { +func (q *Queries) GetMaxEventSeq(ctx context.Context) (int64, error) { row := q.db.QueryRowContext(ctx, getMaxEventSeq) - var coalesce interface{} - err := row.Scan(&coalesce) - return coalesce, err + var max_seq int64 + err := row.Scan(&max_seq) + return max_seq, err } const persistEvent = `-- name: PersistEvent :exec diff --git a/Server/db/dbgen/querier.go b/Server/db/dbgen/querier.go index 8cda0240..61bcfb89 100644 --- a/Server/db/dbgen/querier.go +++ b/Server/db/dbgen/querier.go @@ -61,7 +61,7 @@ type Querier interface { GetEventsSince(ctx context.Context, arg GetEventsSinceParams) ([]GetEventsSinceRow, error) GetInvite(ctx context.Context, code string) (GetInviteRow, error) GetLatestMessageID(ctx context.Context, channelID int64) (interface{}, error) - GetMaxEventSeq(ctx context.Context) (interface{}, error) + GetMaxEventSeq(ctx context.Context) (int64, error) GetMessage(ctx context.Context, id int64) (Message, error) GetMessagesByChannel(ctx context.Context, arg GetMessagesByChannelParams) ([]GetMessagesByChannelRow, error) GetMessagesByChannelBeforeCursor(ctx context.Context, arg GetMessagesByChannelBeforeCursorParams) ([]GetMessagesByChannelBeforeCursorRow, error)