feat: add uuidv7 support for pgsql#16113
Open
W1ckh3ad wants to merge 3 commits intopayloadcms:mainfrom
Open
Conversation
f964a62 to
16f4941
Compare
Author
|
Hello I saw that the e2e failed import { createIntConfig } from './utilities/int-matrix.ts'
createIntConfig({
databases: [
'mongodb',
'mongodb-atlas',
'documentdb',
'cosmosdb',
'firestore',
'postgres',
'postgres-custom-schema',
'postgres-uuid',
+ 'postgres-uuidv7',
'postgres-read-replica',
'supabase',
'sqlite',
'sqlite-uuid',
+ 'sqlite-uuidv7',
],
shards: 3,
})Should i update the file as shown? Also i uploaded a rebase :) |
Member
|
Looks like the build is failing also. But yes, I think we might want to add those to GitHub CI as well |
Author
|
Build is working locally I fixed the lockfile now the build should work, now i test e2e locally |
Author
|
tests:
running those tests i get changed in those two files (result of git diff numstat):
it changes mostly id types from number to string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Let projects use UUID v7 (time-ordered UUIDs) for collection IDs via
idType: 'uuidv7'on Postgres-related adapters (and SQLite wiring), while keeping the same storage shape as v4 UUIDs (nativeuuidon Postgres, text on SQLite).What?
idType: 'uuidv7'alongside existing'serial' | 'uuid'(Postgres) and'number' | 'uuid'(SQLite).uuidpackagev7()(not database-native), so older Postgres versions are still supported.defaultV7on the raw column,$defaultFn/ generated schema code).PAYLOAD_DATABASE=postgres-uuidv7and a test adapter presetpostgres-uuidv7.Why?
UUID v7 is sortable by creation time and tends to be friendlier for B-tree indexes than random UUID v4, without changing the wire format or Postgres column type.
How?
uuidin@payloadcms/drizzleto a version that exportsv7.idTypeunions andUUIDRawColumnwithdefaultV7.setColumnID,buildDrizzleTable,columnToCodeConverter), set app-side defaults for v7; treatuuidv7likeuuidfor relationships and query sanitization via a smallisUUIDTypehelper andgetCollectionIdTypemapping to'text'.Fixes #11449