mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
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 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -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 ; \
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user