Comments (7)
Hey @rodrigocipriani , thanks for reaching out. I'm sorry that you ran into this issue, and I think I've ran into something similar in the past, but never bothered to fix it since I don't really need this project anymore. Let me see if I can get a fix slapped together, though. For future reference, it is helpful to maintainers to provide them with artefacts as plaintext, rather than screenshots, respectfully! :)
from prisma-case-format.
So, back in February of this year, I did manage to get a fix to this issue merged!
94c391d#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
With this fix, I then generated [email protected]
which is available on npm
today. Can you please and thanks double check that you're running the latest version? I ran your snippet through my @1.0.4
on my local machine and was able to get the @relation
tags behaving properly.
The latest version: https://www.npmjs.com/package/prisma-case-format/v/1.0.4
from prisma-case-format.
Thanks for testing. I have just tested again, and it continues not converting the relation. I've double-checked and I'm using @1.0.4 .
Follow the code example:
model JiraIssues {
id Int @id @default(autoincrement())
projects Projects? @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "jira_issues_projects_fkey")
}
So I get this example of error when I try to use it:
234 | publicId String? @default(dbgenerated("uuid_generate_v4()")) @map("public_id") @db.VarChar
235 | projects Projects? @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "jira_issues_projects_fkey")
|
error: Error validating: The argument fields must refer only to existing fields. The following fields do not exist in this model: task_id
--> schema.prisma:236
|
235 | projects Projects? @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "jira_issues_projects_fkey")
236 | tasks Tasks? @relation(fields: [task_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fk_jira_issues_tasks")
|
Maybe I'm missing something.
from prisma-case-format.
@rodrigocipriani, it's all good I may be missing something too. I understand that you've got some model you'd like to keep private probably. Would you be able to build a minimal, sharable working copy of a schema.prisma
that reproduces the issue you are seeing? Also, could I ask for some other pieces of data such as: (1) npm/yarn/pnpm/node versions (2) OS version (3) prisma/prisma-cli versions? Please and thanks!
from prisma-case-format.
For sure, I'll send some information here.
Pre-format schema example:
model projects {
id Int @id @default(autoincrement())
name String? @db.VarChar
jira_issues jira_issues[]
}
model jira_issues {
id Int @id @default(autoincrement())
jira_integration_id Int?
projects projects? @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "jira_issues_projects_fkey")
}
Converted schema:
model Projects {
id Int @id @default(autoincrement())
name String? @db.VarChar
jiraIssues JiraIssues[]
@@map("projects")
}
model JiraIssues {
id Int @id @default(autoincrement())
jiraIntegrationId Int? @map("jira_integration_id")
projects Projects? @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "jira_issues_projects_fkey")
@@map("jira_issues")
}
package.json used on this sample:
{
"name": "prismaconvertertest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"convert": "prisma-case-format"
},
"author": "",
"license": "ISC",
"devDependencies": {
"prisma-case-format": "^1.0.4"
}
}
Node: 16.17.0
Npm: 8.15.0
Prisma-cli: 3.11.1
MacBook Pro: Chip > Apple M1 Pro | OS Version > Ventura 13.0.1
Let me know if I can do something else.
from prisma-case-format.
Hey @rodrigocipriani , I've pushed out v1.0.5, and it looks like it addresses the issue you're seeing. Please let me know if I broke something though, I need to get build deployment automation set up on this project. Sorry for the delay!
from prisma-case-format.
Hey @iiian, I tested v1.0.5 right now, and it works perfectly. I'll test it with more time, but I really think it's done. Thank you so much for being so kind and fast.
Merry Christmas's 🎅🏻
from prisma-case-format.
Related Issues (20)
- `Unsupported` fields are parsed incorrectly HOT 5
- Enums are not mapped HOT 5
- Add a LICENSE file HOT 4
- Ignore Command & Excluding Enums HOT 4
- Any way to keep enums singular when table names are plural? HOT 3
- Broken output for pascal case HOT 4
- New version of package have old content HOT 1
- No @@map created for enums HOT 5
- Possibility to skip some models HOT 23
- Q. How to use this tool ? HOT 8
- Retain @map annotations for fields with distinct DB column names HOT 6
- Add option to ignore pluralize option per field HOT 8
- [Feature request] Obtain default schema location from package.json
- [Feature request] Enable configuration via package.json HOT 1
- Allow programmatic usage of library (example: vscode formatter extension) HOT 2
- Run Prisma's `formatSchema` before AND after the case formatting to automatically add missing relations HOT 2
- MongoDB ID field issue HOT 4
- Invalid `--uses-next-auth` cli option HOT 1
- Config file does not load before `tryGetFileContents` HOT 2
- Camel case not working as expected for fields with numbers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma-case-format.