Skip to content

Commit

Permalink
Add Matt's changes for add composite foreign key references
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolg42 committed Mar 5, 2020
1 parent 45edc40 commit afaf7ca
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cli/prisma2/src/__tests__/integrate.sqlite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ const prettyName = (fn: any): string => {
tests().map((t: Test) => {
const name = prettyName(t.do)

// if (!t.run) {
// it.skip(name)
// return
// }

if (t.todo) {
it.skip(name)
return
Expand Down Expand Up @@ -137,6 +142,7 @@ async function generate(test: Test, datamodel: string) {
type Test = {
title?: string
todo?: boolean
run?: boolean
up: string
down: string
do: (client: any) => Promise<any>
Expand Down Expand Up @@ -1653,6 +1659,7 @@ function tests(): Test[] {
},
{
todo: true,
//SqliteError: FOREIGN KEY constraint failed
up: `
pragma foreign_keys = 1;
create table a (
Expand All @@ -1661,6 +1668,7 @@ function tests(): Test[] {
primary key ("one", "two")
);
create table b (
id integer primary key autoincrement not null,
one integer not null,
two integer not null,
foreign key ("one", "two") references a ("one", "two")
Expand All @@ -1673,10 +1681,11 @@ function tests(): Test[] {
drop table if exists b;
`,
do: async client => {
return client.a.findOne({ where: { variables_value_email_key: { value: 'c', email: 'd' } } })
return client.a.findOne({ where: { one_two: { one: 1, two: 2 } } })
},
expect: {
// TODO
one: 1,
two: 2,
},
},
{
Expand Down

0 comments on commit afaf7ca

Please sign in to comment.