UUID is not auto generated
See original GitHub issueHi,
I have one issue that would like to ask here.
If I set the id to INTEGER it will be auto-generated, but if I use UUID it’s not. This is my model.
class User extends Model {
static table = 'users'
static timestamps = true
static fields = {
id: {
type: DataTypes.UUID,
primaryKey: true,
},
....
}
Do I miss anything to have this auto-generated?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Auto-generated primary keys: UUID, serial or identity column?
Numbers generated by a sequence and UUID s are both useful as auto-generated primary keys. Use identity columns unless you need to generate ......
Read more >UUID not getting auto generated in Spring JPA Hibernate
Simply assign the UUID as the default value: @Entity @Table(name = "decileconfig") public class DecileConfig extends BaseEntity { @Id ...
Read more >How to generate UUIDs as primary keys with Hibernate
Using Hibernate 6, you can annotate your primary key attribute with @UuidGenerator and set the style to RANDOM, AUTO, or don't specify it....
Read more >What is a UUID, and why should you care? - Cockroach Labs
(Technically, it's not impossible that the same UUID we generate ... SQL we can ensure it auto-generates a UUID v4 for each row...
Read more >SQL Primary Key - UUID or Auto Increment Integer / Serial?
Less space. UUID always occupies 16 bytes. For Auto Increment Integer, when stored as Long format, it occupies 8 bytes. If the table...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi autsada,
For now, UUID fields are not auto-generated indeed.
I just found that Deno has a
uuid
helper in the standard library, so here’s how you can do it:Let me know if this works for you.
Keep in touch
I feel like I might have won an award for the weirdest bug I have ever see, consider the following user model:
On running I get a TS error:
If I flip the ID type to
DataTypes.STRING
- it boots up fine, but then when a row is added to the DB the ID isIt’s evaling the string of the function…?