Git Product home page Git Product logo

Comments (7)

iiian avatar iiian commented on July 20, 2024

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.

iiian avatar iiian commented on July 20, 2024

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.

rodrigocipriani avatar rodrigocipriani commented on July 20, 2024

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.

iiian avatar iiian commented on July 20, 2024

@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.

rodrigocipriani avatar rodrigocipriani commented on July 20, 2024

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.

iiian avatar iiian commented on July 20, 2024

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.

rodrigocipriani avatar rodrigocipriani commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.