Skip to content

Commit cf87871

Browse files
authored
test: fix database/int.spec.ts with postgres custom schema (#12922)
The test was failing because in case you have a custom schema, you need to use `payload.db.pgSchema.table` instead of `pgTable` to define a table
1 parent 751691a commit cf87871

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/database/int.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,12 +1744,14 @@ describe('database', () => {
17441744

17451745
// eslint-disable-next-line jest/no-conditional-in-test
17461746
if (payload.db.name.includes('postgres')) {
1747-
added_table_before = drizzlePg.pgTable('added_table_before', {
1747+
// eslint-disable-next-line jest/no-conditional-in-test
1748+
const t = (payload.db.pgSchema?.table ?? drizzlePg.pgTable) as typeof drizzlePg.pgTable
1749+
added_table_before = t('added_table_before', {
17481750
id: drizzlePg.serial('id').primaryKey(),
17491751
text: drizzlePg.text('text'),
17501752
})
17511753

1752-
added_table_after = drizzlePg.pgTable('added_table_after', {
1754+
added_table_after = t('added_table_after', {
17531755
id: drizzlePg.serial('id').primaryKey(),
17541756
text: drizzlePg.text('text'),
17551757
})

0 commit comments

Comments
 (0)