Add initial code to support unique per-entry IDs

This code has two caveats for old entries:
1. the ID is being backfiled with a random per-(device,entry) ID. So the ID won't match cross-device.
2. the server-side ID will still be a random ID that is unrelated to the entry ID
This commit is contained in:
David Dworken
2023-09-22 13:16:24 -07:00
parent 2a5a6d65c4
commit a5f11af150
6 changed files with 22 additions and 2 deletions

View File

@ -303,6 +303,7 @@ func ImportHistory(ctx context.Context, shouldReadStdin, force bool) (int, error
StartTime: time.Now().UTC(),
EndTime: time.Now().UTC(),
DeviceId: config.DeviceId,
EntryId: uuid.Must(uuid.NewRandom()).String(),
}
err = ReliableDbCreate(db, entry)
if err != nil {