Skip to content

Commit 256a7dd

Browse files
committed
refactor(cli,fixtures,docs): migrate remaining @relation(fields:/references:) in .psl/.ts/.md to from/to
Finish the from/to migration for non-.prisma sites the .prisma-focused passes missed: the SQL emit-command parity .psl fixture, the Postgres PSL init template string (and its snapshot), and live authoring examples in the SQL contract-psl README, the prisma-next-contract skill, two subsystem docs, and ADR 121 / ADR 226 worked examples. Deliberate legacy sites are left intact: resolver rejection tests and diagnostic strings, parser/printer fidelity fixtures that never reach the resolver, frozen release/upgrade history (CHANGELOG, releases, upgrade recipe), project design records under projects/, and ADR 226 prose explaining the legacy attribute grammar. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
1 parent 3a71c13 commit 256a7dd

9 files changed

Lines changed: 12 additions & 12 deletions

File tree

docs/architecture docs/adrs/ADR 121 - Contract.d.ts structure and relation typing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ model Post {
4040
id Int @id @default(autoincrement())
4141
title String
4242
userId Int
43-
user User @relation(fields: [userId], references: [id])
43+
user User @relation(from: [userId], to: [id])
4444
createdAt DateTime @default(now())
4545
}
4646
```
@@ -235,7 +235,7 @@ model User {
235235
236236
model Profile {
237237
id Int @id
238-
user User @relation(fields: [userId], references: [id])
238+
user User @relation(from: [userId], to: [id])
239239
userId Int @unique
240240
}
241241
```
@@ -264,7 +264,7 @@ model User {
264264
265265
model Post {
266266
id Int @id
267-
user User @relation(fields: [userId], references: [id])
267+
user User @relation(from: [userId], to: [id])
268268
userId Int
269269
}
270270
```

docs/architecture docs/adrs/ADR 226 - Cross-contract foreign-key references.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace public {
1919
model Profile {
2020
id String @id @default(uuid())
2121
userId Uuid @unique
22-
user supabase:auth.AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
22+
user supabase:auth.AuthUser @relation(from: [userId], to: [id], onDelete: Cascade)
2323
}
2424
}
2525
```

docs/architecture docs/subsystems/2. Contract Emitter & Types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ model User {
3131
model Post {
3232
id Int @id @default(autoincrement())
3333
title String
34-
user User @relation(fields: [userId], references: [id])
34+
user User @relation(from: [userId], to: [id])
3535
userId Int
3636
@@index([userId])
3737
}

docs/architecture docs/subsystems/6. Ecosystem Extensions & Packs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ namespace public {
375375
model Profile {
376376
id String @id @default(uuid())
377377
userId Uuid @unique // @unique makes this a 1:1 relationship
378-
user supabase:auth.AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
378+
user supabase:auth.AuthUser @relation(from: [userId], to: [id], onDelete: Cascade)
379379
@@map("profile")
380380
}
381381
}

packages/1-framework/3-tooling/cli/src/commands/init/templates/code-templates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ model Post {
126126
id Int @id @default(autoincrement())
127127
title String
128128
content String?
129-
author User @relation(fields: [authorId], references: [id])
129+
author User @relation(from: [authorId], to: [id])
130130
authorId Int
131131
createdAt DateTime @default(now())
132132
updatedAt temporal.updatedAt()

packages/1-framework/3-tooling/cli/test/commands/init/__snapshots__/templates.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ model Post {
606606
id Int @id @default(autoincrement())
607607
title String
608608
content String?
609-
author User @relation(fields: [authorId], references: [id])
609+
author User @relation(from: [authorId], to: [id])
610610
authorId Int
611611
createdAt DateTime @default(now())
612612
updatedAt temporal.updatedAt()

packages/2-sql/2-authoring/contract-psl/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Unsupported PSL constructs in v1 (strict errors):
5151
- Scalar lists like `String[]`
5252
- Enum lists and named-type lists
5353
- **Relation navigation lists are supported** when they can be matched to an FK-side relation:
54-
- Example: `User.posts Post[]` + `Post.user User @relation(fields: [userId], references: [id])`
54+
- Example: `User.posts Post[]` + `Post.user User @relation(from: [userId], to: [id])`
5555
- Matching may use `@relation("Name")` or `@relation(name: "Name")` when multiple candidates exist
5656
- Navigation list fields accept only `@relation` (name-only form); other field attributes are strict errors
5757
- **Implicit Prisma ORM many-to-many remains unsupported** (list navigation on both sides without explicit join model)

skills/prisma-next-contract/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ model Post {
9393
id Int @id @default(autoincrement())
9494
title String
9595
authorId Int
96-
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
96+
author User @relation(from: [authorId], to: [id], onDelete: Cascade)
9797
9898
@@unique([title, authorId])
9999
@@index([authorId])
@@ -290,7 +290,7 @@ namespace public {
290290
id String @id @default(uuid())
291291
username String
292292
userId Uuid @unique
293-
user supabase:auth.AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
293+
user supabase:auth.AuthUser @relation(from: [userId], to: [id], onDelete: Cascade)
294294
@@map("profile")
295295
}
296296
}

test/integration/test/fixtures/cli/cli-integration-test-app/fixtures/emit-command/schema.parity.psl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ model Post {
2424
userId Int
2525
title String
2626
rating Float?
27-
author User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
27+
author User @relation(from: [userId], to: [id], onDelete: Cascade, onUpdate: Cascade)
2828
@@index([userId])
2929
@@unique([title, userId])
3030
}

0 commit comments

Comments
 (0)