Skip to content

Commit

Permalink
test regression
Browse files Browse the repository at this point in the history
  • Loading branch information
millsp committed Oct 4, 2023
1 parent 7533183 commit e502f6b
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
@@ -0,0 +1,21 @@
import { defineMatrix } from '../../_utils/defineMatrix'

export default defineMatrix(() => [
[
{
provider: 'sqlite',
},
{
provider: 'postgresql',
},
{
provider: 'mysql',
},
{
provider: 'cockroachdb',
},
{
provider: 'sqlserver',
},
],
])
@@ -0,0 +1,37 @@
import { foreignKeyForProvider, idForProvider } from '../../../_utils/idForProvider'
import testMatrix from '../_matrix'

export default testMatrix.setupSchema(({ provider }) => {
return /* Prisma */ `
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "${provider}"
url = env("DATABASE_URI_${provider}")
}
model User1 {
email ${idForProvider(provider)}
relation1 Relation1[]
}
model Relation1 {
id ${idForProvider(provider)}
user User1 @relation(fields: [email], references: [email])
email ${foreignKeyForProvider(provider)}
}
model User2 {
id ${idForProvider(provider)}
relation2 Relation2[]
}
model Relation2 {
field ${idForProvider(provider)}
user User2 @relation(fields: [email], references: [id])
email ${foreignKeyForProvider(provider)}
}
`
})
@@ -0,0 +1,45 @@
import testMatrix from './_matrix'
// @ts-ignore
import type { PrismaClient } from './node_modules/@prisma/client'

declare let prisma: PrismaClient

testMatrix.setupTestSuite(
() => {
// TODO: this currently fails with "The column `j1.id` does not exist in the current database.".
// Close https://github.com/prisma/prisma/issues/21352 once fixed.
test('[1] should not fail', async () => {
await prisma.relation1.findMany({
select: {
id: true,
},
where: {
user: {
email: 'info@example.com',
},
},
})
})

// TODO: this currently fails with "The column `j1.field` does not exist in the current database.".
// Close https://github.com/prisma/prisma/issues/21352 once fixed.
test('[2] should not fail', async () => {
await prisma.relation2.findMany({
select: {
field: true,
},
where: {
user: {
id: 'info@example.com',
},
},
})
})
},
{
optOut: {
from: ['mongodb'],
reason: 'Only SQL databases were affected by regression #21352',
},
},
)

0 comments on commit e502f6b

Please sign in to comment.