fix issue with db on conflict

postgress doesn't like that, so two queries
This commit is contained in:
Enot (ded) Skelly committed 2026-05-26 11:17:38 -07:00
1 parent 5321151f7e
commit 63c0ff37e1
4 files changed
+41 -1

No files matched your search

+15
View File
@@ -1319,6 +1319,21 @@ func (q *Queries) UpsertChannel(ctx context.Context, arg UpsertChannelParams) (C
return i, err
}
const upsertChannelHashOnly = `-- name: UpsertChannelHashOnly :one
INSERT INTO channels (channel_hash, last_seen)
VALUES ($1, NOW())
ON CONFLICT (channel_hash) WHERE key_fingerprint IS NULL DO UPDATE SET
last_seen = NOW()
RETURNING id
`
func (q *Queries) UpsertChannelHashOnly(ctx context.Context, channelHash []byte) (int32, error) {
row := q.db.QueryRow(ctx, upsertChannelHashOnly, channelHash)
var id int32
err := row.Scan(&id)
return id, err
}
const upsertIATA = `-- name: UpsertIATA :exec
INSERT INTO iata_codes (iata)