Table and column name mapping bug
See original GitHub issueHi, I’ve encountered a weird bug with how I’m using mappings and prisma-erd-generator
. Everything in Prisma generates the way I’d expect but prisma-erd-generator
generates a svg for me with names I’m not expecting. Here’s some example that recreates the issue:
prisma.schema
:
generator client {
provider = "prisma-client-js"
output = "client"
}
generator erd {
provider = "prisma-erd-generator"
output = "./erd.svg"
theme = "default"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Store {
@@map("stores")
id String @map("store_id") @id @default(uuid())
employees Employee[]
customers Customer[]
}
model Employee {
@@map("employees")
id String @map("employee_id") @id @default(uuid())
storeId String @map("store_id")
store Store @relation(fields: [storeId], references: [id])
orders Order[]
}
model Customer {
@@map("customers")
id String @map("customer_id") @id @default(uuid())
storeId String @map("store_id")
store Store @relation(fields: [storeId], references: [id])
orders Order[]
}
model Order {
@@map("orders")
id String @map("order_id") @id @default(uuid())
employeeId String @map("employee_id")
customerId String @map("customer_id")
employee Employee @relation(fields: [employeeId], references: [id])
customer Customer @relation(fields: [customerId], references: [id])
}
SVG generated by prisma-erd-generator
:
What I expecting to see in the SVG was: the PK for the orders table should be order_id
, PK for the employees table should be employee_id
, and PK for customers should be customer_id
.
Am I doing something wrong?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Oracle Table and Column name Bug
Oracle seems to be unable to remember whether a table or column name I enter is Lower case, upper case or camel case....
Read more >[DOC] Glue table column name mapping with connector ...
Run a select query on the table and observe that no information is returned. Add columnMapping in the Glue table's Table properties <Glue...
Read more >Mapping: Table contains physical column name referred to ...
When you use a named column reference in any way on one class field, make sure ALL references use the exact same name....
Read more >Delta tables: Cannot set default column mapping mode ...
I have managed to do it in SQL using TBLPROPERTIES with the CREATE TABLE statement like so: CREATE TABLE table_bronze_csv; USING CSV; OPTIONS...
Read more >306356 – [DB] Handle table/column names using ... - Bugs
Bug 306356 - [DB] Handle table/column names using reserved words without modifying ... readValuesFromStatement(AbstractHorizontalClassMapping.java:295) at ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Works perfectly within my test scenario and project 🚀 Thanks for the quick turn around on this @keonik!
@francismanansala can you give v1.0.2 a test. I’m trying on my project now but I didn’t have this issue before. Test case was written so I’m assuming this is safe to be closed