fix(db-postgres): allow the same block slug in different places with a different localized value (#12414)

Fixes https://github.com/payloadcms/payload/issues/12409
Now Payload automatically resolves table names conflicts in those cases,
as well as Drizzle relation names.

---------

Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
This commit is contained in:
Sasha
2025-05-15 23:48:41 +03:00
committed by GitHub
parent 1f6efe9a46
commit 219fd01717
17 changed files with 244 additions and 67 deletions

View File

@@ -2515,4 +2515,17 @@ describe('database', () => {
expect(result_2.totalDocs).toBe(0)
})
it('can have localized and non localized blocks', async () => {
const res = await payload.create({
collection: 'blocks-docs',
data: {
testBlocks: [{ blockType: 'cta', text: 'text' }],
testBlocksLocalized: [{ blockType: 'cta', text: 'text-localized' }],
},
})
expect(res.testBlocks[0]?.text).toBe('text')
expect(res.testBlocksLocalized[0]?.text).toBe('text-localized')
})
})