Comments (8)
a followup thought, since renaming enums isn't compulsory, should prisma-case-format leave them alone? And/or provide another CLI option to provide a mapping directive and use @@map
too? e.g. something like --map-enum-case PascalCase
from prisma-case-format.
a followup thought, since renaming enums isn't compulsory, should prisma-case-format leave them alone? And/or provide another CLI option to provide a mapping directive and use
@@map
too? e.g. something like--map-enum-case PascalCase
Could be. I may have more time to look into this issue this weekend or next, will keep you posted once I can immerse my head back in this project
from prisma-case-format.
Hey @iiian - sorry for the late response here, got caught up with other things. I am using the new version and it is working great, thanks for your efforts!
from prisma-case-format.
Hey Zach, I'm glad it's of some value!
I think @@map('enum_name')
makes sense too, and I was debating inserting it at one point because it wasn't quite compulsory. For my testing purposes, how are you using the command? Are you using --map-table-case
at all?
from prisma-case-format.
Here's the command string I use.
npx prisma-case-format --file ./prisma/schema.prisma
I had not tried using --map-table-case
yet.
I actually manually went through and added @@map
to every enum and that kept them from being changed back to snake_case by Prisma.
from prisma-case-format.
Another big thanks for putting this together, and another vote for enum handling.
from prisma-case-format.
@fullstackzach, I plan to house the behavior of a flag like --map-enum-case
under --map-table-case
. I don't think it will hurt for the tool to start outputting @@map
on all of the schemas for either db-first or model-first. Similarly, I think that for the time-being, I would think people want to have their model
s view
s and enum
s all have the same case convention, which is controlled by --map-table-case
. But who knows! Do you have any further strong opinions on the matter? Feel free to share if applicable.
from prisma-case-format.
I've released v1.4.0
implementing this feature, if you could pull that version, give it a quick spin and see how it works, that would be appreciated!
https://www.npmjs.com/package/prisma-case-format
from prisma-case-format.
Related Issues (20)
- Enums are not mapped 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
- Config file does not load before `tryGetFileContents` HOT 2
- Camel case not working as expected for fields with numbers
- Add a prefix to enum `@@map`
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.