Skip to content

Commit c2571cf

Browse files
jmikrutPatrikKozak
andauthored
fix(db-postgres): uuid custom db name (#6408)
## Description Fixes an issue with creating versions when using custom DB names, `uuid`, and drafts. --------- Co-authored-by: PatrikKozak <patrik@payloadcms.com>
1 parent 12c812d commit c2571cf

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/db-postgres/src/createVersion.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ export async function createVersion<T extends TypeWithID>(
4545

4646
const table = this.tables[tableName]
4747

48-
const relationshipsTable =
49-
this.tables[`_${defaultTableName}${this.versionsSuffix}${this.relationshipsSuffix}`]
48+
const relationshipsTable = this.tables[`${tableName}${this.relationshipsSuffix}`]
5049

5150
if (collection.versions.drafts) {
5251
await db.execute(sql`

test/database/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ export default buildConfigWithDefaults({
157157
],
158158
},
159159
],
160-
versions: true,
160+
versions: {
161+
drafts: true,
162+
},
161163
},
162164
],
163165
globals: [

0 commit comments

Comments
 (0)