Identity Types
The identity type provides automatic UUID primary key generation.
col.id()
Section titled “col.id()”Generates a UUID v4 primary key column.
| Expands To |
|---|
uuid + primary_key + default(uuid_generate_v4()) |
export default table({ id: col.id(), name: col.name(),});Usage Notes
Section titled “Usage Notes”- Always use
col.id()as the first column in your table - UUIDs are generated server-side, not client-side
- Compatible with distributed systems and replication