(no title)
tsarchitect | 2 years ago
|------------------------------|-----------------------------|------------|----
| primaryKey (bigInt-internal) | publicKey (uuidv4-external) | created_at | ...
|------------------------------|-----------------------------|------------|----
(2) |------------------------------|-----------------------------|------------|----
| primaryKey (uuidv4-internal) | publicKey (uuidv4-external) | created_at | ...
|------------------------------|-----------------------------|------------|----
(3) |------------------------------|-----------------------------|----
| primaryKey (uuidv7-internal) | publicKey (uuidv4-external) | ...
|------------------------------|-----------------------------|----
(4) (not recommended)
|---------------------|----
| primaryKey (uuidv7) | ...
|---------------------|----
---- (1) [X] sortable by insertion, [X] timestamp
(2) All of (1) and [X] transferable between databases
(3) Use UUIDv7 as a primary key for internal and UUIDv4 for external. App or SELECT statement will need to extract the timestamp from UUIDv7 if you need to use it. Also, if you're using a DB Client you can't just view the 'created_at' column to get an idea of when a row was created.
(4) Use UUIDv7 as a primary key for internal & external use.
No comments yet.