replaced exists bool db scans with int for broader drivers compatibility

This commit is contained in:
Gani Georgiev
2025-01-20 14:16:00 +02:00
parent 0ebe9c4faa
commit a4a228b368
11 changed files with 25 additions and 23 deletions

View File

@@ -762,9 +762,9 @@ func (c *Collection) updateGeneratedIdIfExists(app App) {
// add a number to the current id (if already exists)
for i := 2; i < 1000; i++ {
var exists bool
var exists int
_ = app.CollectionQuery().Select("(1)").AndWhere(dbx.HashExp{"id": newId}).Limit(1).Row(&exists)
if !exists {
if exists == 0 {
break
}
newId = c.idChecksum() + strconv.Itoa(i)