Replies: 5 comments 50 replies
-
hi manson, this is happening because i didn't define uuid in user model as unique key, foreign keys in sql can be binded only to unique columns, so it should work with the user email which is unique, and i should add like for email, an iunique to the uuid. |
Beta Was this translation helpful? Give feedback.
-
Hi! |
Beta Was this translation helpful? Give feedback.
-
@manson , i added these hooks, they will work only with the korm Insert Set Delete AddRelated DeleteRelated and Drop: OnInsert(func(database, table string, data map[string]any) error {
fmt.Println("inserting into", database, table, data)
return nil
})
OnSet(func(database, table string, data map[string]any) error {
fmt.Println("set into", database, table, data)
return nil
})
OnDelete(func(database, table, query string, args ...any) error {})
OnDrop(func(database, table string) error {}) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@kamalshkeir |
Beta Was this translation helpful? Give feedback.
-
Hi!
I just want to bind this model to a User model but not to Id field rather than to Uuid field (see UserId field), but when adding this record by using Admin panel, I get an error like "SQL logic error: foreign key mismatch - "sell_units" referencing "users" ". Why? User model has the same string Uuid field (40 length) to which my UserId referencing and in korm the mask (table:field:delete:update) suppose to use any field to bind to.
Beta Was this translation helpful? Give feedback.
All reactions