Fixes for HistoryUUID

This commit is contained in:
Magnus Åhall 2026-06-10 08:03:33 +02:00
parent be7f5dbf30
commit 3e8d5b6d9a
7 changed files with 176 additions and 18 deletions

View file

@ -44,6 +44,7 @@ type Node struct {
UUID string
UserID int `db:"user_id"`
ParentUUID string `db:"parent_uuid"`
HistoryUUID string `db:"history_uuid"`
Name string
Created time.Time
Updated time.Time
@ -122,7 +123,7 @@ func Nodes(userID, offset int, synced uint64, clientUUID string) (nodes []Node,
rows, err = db.Queryx(`
SELECT
uuid,
COALESCE(parent_uuid, '') AS parent_uuid,
COALESCE(parent_uuid, '00000000-0000-0000-0000-000000000000'::uuid) AS parent_uuid,
name,
created,
updated,
@ -137,7 +138,7 @@ func Nodes(userID, offset int, synced uint64, clientUUID string) (nodes []Node,
public.node
WHERE
user_id = $1 AND
client != $5 AND
client != $5::uuid AND
NOT history AND (
created_seq > $4 OR
updated_seq > $4 OR
@ -251,6 +252,7 @@ func RetrieveNodeHistory(userID int, nodeUUID string, offset int) (nodes []Node,
rows, err = db.Queryx(`
SELECT
uuid,
history_uuid,
user_id,
name,
created,