Simple.Data with Non Auto Increment Primary Key (uuid_short)
-
08-07-2021 - |
سؤال
I am using Simple.Data as my Micro-ORM for my ASP.NET / MySQL website. I already know how to insert data when the primary key is auto incremental Int, but How can I insert data when I need to generate an idea using the uuid_short() function over a Bigint column?
المحلول
You could use a trigger to set the column value, as in this answer: Can I use a function for a default value in MySql?
Or you can generate a value in your application code and insert it normally.
لا تنتمي إلى StackOverflow