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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support overwrite of @map and @@map ERD prisma schema usage #8

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

keonik
Copy link

@keonik keonik commented Oct 19, 2021

I haven't used parcel before so I wasn't spending much time running this. I just copied over the function to search the data model string for @map and @@map to replace in your render SVG from DML functions.

@vercel
Copy link

vercel bot commented Oct 19, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/skn0tt/prisma-erd/32U6oBsstj83Jkf1tDxwbyEzEJSq
✅ Preview: https://prisma-erd-git-fork-keonik-master-skn0tt.vercel.app

@Skn0tt
Copy link
Owner

Skn0tt commented Oct 19, 2021

Hi @keonik, thanks a ton for this PR! I checked the deploy preview, but there seems to be some error. You can run it locally by running vercel dev, I think

@keonik
Copy link
Author

keonik commented Oct 20, 2021

@Skn0tt I think the 500 error is unrelated to the commit. The latest deployment has it commented out to see if it was the culprit. It still is getting that error. I'm playing around with updating some dependencies. Maybe something changed in the dependencies

@Skn0tt
Copy link
Owner

Skn0tt commented Oct 20, 2021

Alright, the deployment works again. @keonik I'm trying to verify this actually does what it's supposed to do, and added some @map directives to my schema. I have trouble finding a combination where this branch outputs something different than master - could you maybe share a Prisma schema file?

@keonik
Copy link
Author

keonik commented Oct 20, 2021

I commented it out while I was troubleshooting the 500 error. It's turned back on now. Here are separate examples. You should be able to just add @map("db_name") to any of the rows and @@map("table_name") to any of the models at the bottom of the rows.

test @map

model User {
      id              Int                 @id @default(autoincrement())
      hashedPassword  String?             @map("hashed_password")
}

test @@map

model User {
      id              Int                 @id @default(autoincrement())
      hashedPassword  String?             
      @@map("users")
}

@keonik
Copy link
Author

keonik commented Oct 20, 2021

Still doesn't appear to be working. hmm.

@keonik
Copy link
Author

keonik commented Oct 20, 2021

Is this datamodelString the string from the request? I wasn't able to get it running locally using vercel for some reason.

@Skn0tt
Copy link
Owner

Skn0tt commented Oct 21, 2021

No, datamodelString is the already-parsed string. req.body is what you're looking for, I think.

@keonik
Copy link
Author

keonik commented Oct 22, 2021

Looks like usage of the single @map is working. Renaming the model isn't for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants