From 157788b73b55614e9a8ed0343e7fa3599a8ffee8 Mon Sep 17 00:00:00 2001 From: "Hein (Warky)" Date: Tue, 5 May 2026 09:52:31 +0200 Subject: [PATCH] fix(todo): document issue with GormResult.LastInsertId() not returning correct ID --- todo.md | 1 + 1 file changed, 1 insertion(+) diff --git a/todo.md b/todo.md index e156b44..da8fc52 100644 --- a/todo.md +++ b/todo.md @@ -92,6 +92,7 @@ See [`resolvespec-python/todo.md`](./resolvespec-python/todo.md) for detailed Py - [ ] Long preload alias names may exceed PostgreSQL identifier limit - [ ] Some edge cases in computed column handling +- [ ] `GormResult.LastInsertId()` (`pkg/common/adapters/database/gorm.go:936`) always returns `0, nil` — GORM does not expose last insert ID via `sql.Result` for most dialects. Auto-generated IDs from GORM inserts are not propagated back through `LastInsertId`, which breaks the ID-retrieval path in `recursive_crud.go`. Fix: read the ID back from the model struct after `Create()` using reflection, or use GORM's `Statement.LastInsertId`. ---