Comments (5)
My enums defined in
PascalCase
are not mapped when runningprisma-case-format --map-field-case snake --map-table-case snake
Hi @alizeegtd! Would you be willing to give a minimal example input and point out what your expected vs actual diff is?
from prisma-case-format.
Hi @iiian, my initial Prisma schema looks like:
enum UserLocale {
fr_FR
en_EN
}
model User {
id Int @id @default(autoincrement())
email String @unique
firstName String @default("")
lastName String @default("")
locale UserLocale @default(fr_FR)
}
When I run the following command: prisma-case-format --map-field-case snake --map-table-case snake
, my Prisma schema gets modified to become:
enum UserLocale {
fr_FR
en_EN
}
model User {
id Int @id @default(autoincrement())
email String @unique
firstName String @default("") @map("first_name")
lastName String @default("") @map("last_name")
locale UserLocale @default(fr_FR) @map("locale")
@@map("user")
}
I was expecting to get:
enum UserLocale {
fr_FR
en_EN
@@map("user_locale")
}
model User {
id Int @id @default(autoincrement())
email String @unique
firstName String @default("") @map("first_name")
lastName String @default("") @map("last_name")
locale UserLocale @default(fr_FR) @map("locale")
@@map("user")
}
from prisma-case-format.
version 1.7.3 pushed, please pull and retry
from prisma-case-format.
@iiian Thanks it works now. I'm just surprised that when using the param --map-table-case snake,plural
it pluralize the enum name (e.g. UserLocale
-> @@map("user_locales")
) but that's fine.
from prisma-case-format.
@iiian Thanks it works now. I'm just surprised that when using the param
--map-table-case snake,plural
it pluralize the enum name (e.g.UserLocale
->@@map("user_locales")
) but that's fine.
Well, drop thr plural?
from prisma-case-format.
Related Issues (20)
- Pluralize table names HOT 8
- Some `@@index` cannot be converted HOT 4
- `Unsupported` fields are parsed incorrectly 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
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.