Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: Prisma schema import - when the index model attribute contains an id field that was renamed - it causes errors #8503

Closed
abrl91 opened this issue May 17, 2024 · 1 comment 路 Fixed by #8504
Assignees
Labels
type: bug Something isn't working

Comments

@abrl91
Copy link
Member

abrl91 commented May 17, 2024

What happened?

When we import this schema:

datasource db {
            provider = "postgresql"
            url      = env("DB_URL")
          }
          
          generator client {
            provider = "prisma-client-js"
          }
          
          model Doctor {
            doctor_id       String     @id @default(cuid())
            first_name      String    
            license_id      Int
          
            @@index([doctor_id, license_id], map: "doctor_id_license_id_unique")
          }

The Prisma schema is generated with errors because the generated schema looks as follows:

datasource db {
            provider = "postgresql"
            url      = env("DB_URL")
          }
          
          generator client {
            provider = "prisma-client-js"
          }
          
          model Doctor {
            id       String     @id @default(cuid()) <--- id and not doctor_id
            first_name      String    
            license_id      Int
          
            @@index([doctor_id, license_id], map: "doctor_id_license_id_unique") <--- but here is still doctor_id
          }

What you expected to happen

No compilation errors

How to reproduce

import a schema like in the example above

Amplication version

No response

Environment

No response

Are you willing to submit PR?

Yes I am willing to submit a PR!

@abrl91 abrl91 added the type: bug Something isn't working label May 17, 2024
@abrl91 abrl91 self-assigned this May 17, 2024
@abrl91 abrl91 linked a pull request May 17, 2024 that will close this issue
2 tasks
@mulygottlieb
Copy link
Member

Passed QA

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants