Skip to content

Commit

Permalink
test: connect/disconnect wrong way around
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-prisma committed Feb 6, 2025
1 parent 5aecb49 commit d42ab4b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"query": {
"arguments": {
"where": { "id": 1 },
"data": { "categories": { "disconnect": [{ "id": 1 }] } }
"data": { "categories": { "connect": [{ "id": 1 }] } }
},
"selection": {
"$composites": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"query": {
"arguments": {
"where": { "id": 1 },
"data": { "categories": { "connect": [{ "id": 1 }] } }
"data": { "categories": { "disconnect": [{ "id": 1 }] } }
},
"selection": {
"$composites": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ let @parent = unique (query «SELECT "public"."Post"."id",
const(BigInt(0))])
in let @parent$id = mapField id (get @parent)
in join (get @parent)
with (query «SELECT "public"."Category"."id", "public"."Category"."name",
"t0"."B" AS "CategoryToPost@Post" FROM
"public"."_CategoryToPost" AS "t0" INNER JOIN
"public"."Category" ON "t0"."A" = "public"."Category"."id"
WHERE "t0"."B" = $1»
with (query «SELECT "t1"."id", "t1"."name", "t0"."B" AS
"CategoryToPost@Post" FROM "public"."_CategoryToPost" AS "t0"
INNER JOIN "public"."Category" AS "t1" ON "t0"."A" =
"t1"."id" WHERE "t0"."B" = $1»
params [var(@parent$id as Int)]) on left.(id) = right.(CategoryToPost@Post) as categories
20 changes: 0 additions & 20 deletions query-compiler/query-compiler/tests/snapshots/[email protected]

This file was deleted.

11 changes: 5 additions & 6 deletions query-compiler/query-compiler/tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ let @parent = query «SELECT "public"."Post"."id", "public"."Post"."title",
params [const(BigInt(0))]
in let @parent$id = mapField id (get @parent)
in join (get @parent)
with (query «SELECT "public"."Category"."id", "public"."Category"."name",
"t0"."B" AS "CategoryToPost@Post" FROM
"public"."_CategoryToPost" AS "t0" INNER JOIN
"public"."Category" ON "t0"."A" = "public"."Category"."id"
WHERE "t0"."B" IN /* prisma-comma-repeatable-start */$1/*
prisma-comma-repeatable-end */»
with (query «SELECT "t1"."id", "t1"."name", "t0"."B" AS
"CategoryToPost@Post" FROM "public"."_CategoryToPost" AS "t0"
INNER JOIN "public"."Category" AS "t1" ON "t0"."A" =
"t1"."id" WHERE "t0"."B" IN /* prisma-comma-repeatable-start
*/$1/* prisma-comma-repeatable-end */»
params [var(@parent$id as Int)]) on left.(id) = right.(CategoryToPost@Post) as categories
19 changes: 0 additions & 19 deletions query-compiler/query-compiler/tests/snapshots/[email protected]

This file was deleted.

4 changes: 1 addition & 3 deletions [email protected][email protected]
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
source: query-compiler/query-compiler/tests/queries.rs
assertion_line: 46
expression: pretty
input_file: query-compiler/query-compiler/tests/data/update-m2m-disconnect.json
snapshot_kind: text
input_file: query-compiler/query-compiler/tests/data/update-m2m-connect.json
---
let 0 = unique (query «SELECT "public"."Post"."id", "public"."Post"."title",
"public"."Post"."userId" FROM "public"."Post" WHERE
Expand Down
4 changes: 1 addition & 3 deletions [email protected][email protected]
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
source: query-compiler/query-compiler/tests/queries.rs
assertion_line: 46
expression: pretty
input_file: query-compiler/query-compiler/tests/data/update-m2m-connect.json
snapshot_kind: text
input_file: query-compiler/query-compiler/tests/data/update-m2m-disconnect.json
---
let 0 = unique (query «SELECT "public"."Post"."id", "public"."Post"."title",
"public"."Post"."userId" FROM "public"."Post" WHERE
Expand Down

0 comments on commit d42ab4b

Please sign in to comment.