How to define UUID generated type within a table interface
See original GitHub issueI am unsure if this is supported or if my implementation is incorrect. But I am looking to achieve something like this.
model
interface User {
id: Generated<UUID>;
}
DB write schema
.addColumn("id", "uuid", (col) =>
col.primaryKey().defaultTo(sql`gen_random_uuid()`)
)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Using the UUID data type - Oracle Help Center
A table column can be declared as having UUID type in a CREATE TABLE statement. The UUID data ... This UUID column can...
Read more >How to use a JVM or database auto-generated UUID identifier ...
Learn how to use an auto-generated UUID entity identifier with JPA and Hibernate. The UUID can be either generated in the JVM or...
Read more >The Ultimate Guide on Client-Generated IDs in JPA Entities
UUID generation – is a well-known and widely used approach for ID generation in distributed applications. This datatype is supported by standard ...
Read more >Generate UUID values by default for each row on column of ...
In SQL. You can use built-in function RANDOM_UUID() : create table test(id int primary key, data uuid default random_uuid()); insert into ...
Read more >PostgreSQL - UUID Data Type - GeeksforGeeks
For generating a UUID values based on the blend of computer's MAC address, present timestamp, and a random value, the uuid_generate_v1() ...
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
The
pg
driver returnsUUID
fields as strings --> you need to usestring
as the type in the interface.It is supported and tested.