-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add --map-field-case / --map-table-case option #13
Comments
Hey @marklawlor , glad you found the tool useful. Can you describe your workflow for me? How are new properties being generated, and why is it infeasible to keep them in sync by hand after the initial migration? If I understand correctly, it sounds like you're asking for "don't bother applying conventions if the table or field already has a I'm a bit swamped at work right now, so it could be awhile before I get around to it, but if you wanted to create a PR for this, I would happily merge it in because making the tool idempotent is a reasonable idea. |
We would like to keep our database in snake_case and JS in camelCase/PascalCase for legacy and stylist reasons. It's not infeasible to maintain by hand, and we have been doing so for quite a while - however someone evitiable forgets to add a Prisma has no linting tool, so we rely on PRs to catch human error but mistakes happen. I would like to use this CLI in our CI pipeline:
No. I would like a flag to also apply a case convention to the |
Gotcha. Thanks for correcting me there. I see now that I probably have time to get around to it in the next few weeks, either when work calms down or the mood strikes. You could use |
@marklawlor, I've pushed out prisma-case-format@1.3.0-beta.0 which corresponds to this pull request. Per your suggestion, you can get ongoing convention-drift-checking by calling
I teed up quite a few tests to make sure everything is on the up and up, but it would be great if you could pull this beta version and run it on your setup, even just once, to see if you can spot any obvious bugs. |
That works really well 👍 |
Describe your request
This library does a great job at a one time conversion, however I would like to use it to maintain consistency within my schema.
For example, say I want to maintain pascalCase for columns, but always map them to snake.
If you run
prisma-case-format
nothing will changeProposed behaviour
With the
--map-field-case=snake --map-table-case=snake
flags, the schema will change. Now it is checking that each column correctly maps to the desired case.Workarounds
I tried doing two conversions, eg converting to snake and then pascal, however this created duplicate
@map
on each columnThe text was updated successfully, but these errors were encountered: