Skip to content

Commit

Permalink
add another null test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmueller committed Feb 17, 2020
1 parent 5b37933 commit 73d310f
Showing 1 changed file with 55 additions and 4 deletions.
59 changes: 55 additions & 4 deletions cli/prisma2/src/__tests__/integrate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3044,14 +3044,14 @@ function tests(): Test[] {
model a {
one Int
two Int
bs b[] @relation(references: [a])
@@id([one, two])
}
model b {
a a @map(["one", "two"])
}
/// The underlying table does not contain a unique identifier and can therefore currently not be handled.
// model b {
// a a @map(["one", "two"])
// }
`,
do: async client => {
return client.a.findOne({ where: { variables_value_email_key: { value: 'c', email: 'd' } } })
Expand Down Expand Up @@ -3438,6 +3438,57 @@ function tests(): Test[] {
// TODO
},
},
{
up: `
create table teams (
id serial primary key not null,
name text
);
insert into teams (name) values ('a');
insert into teams (name) values (NULL);
insert into teams (name) values (NULL);
`,
down: `
drop table if exists teams cascade;
`,
schema: `
generator client {
provider = "prisma-client-js"
output = "${tmp}"
}
datasource pg {
provider = "postgresql"
url = "${connectionString}"
}
model teams {
id Int @id
name String?
}
`,
do: async client => {
await client.teams.updateMany({
data: { name: 'b' },
where: { name: null },
})
return client.teams.findMany()
},
expect: [
{
id: 1,
name: 'a',
},
{
id: 2,
name: 'b',
},
{
id: 3,
name: 'b',
},
],
},
]
}

Expand Down

0 comments on commit 73d310f

Please sign in to comment.