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

Any way to keep enums singular when table names are plural? #39

Closed
kolpakov-p opened this issue Nov 9, 2023 · 3 comments · Fixed by #41
Closed

Any way to keep enums singular when table names are plural? #39

kolpakov-p opened this issue Nov 9, 2023 · 3 comments · Fixed by #41

Comments

@kolpakov-p
Copy link
Contributor

Hey!

I have the following schema:

model ConfirmRequest {
  type        ConfirmType @map("type")
  ...

  @@map("confirm_requests")
}

enum ConfirmType {
  EMAIL
  PHONE

  @@map("confirm_type")
}

And I'm running CLI tool as follows:
prisma-case-format --file ./prisma/schema.prisma --map-table-case snake,plural

So, I need to keep enum @@map singular. Do we have any way to achieve that?

In other words, I need to manage enum transform options separately from table ones.

Thanks for great tool!

@iiian
Copy link
Owner

iiian commented Nov 9, 2023

I think we ended up managing table & enum case simultaneously, so at this point it's "because legacy".

we could probably add --map-enum-case to run things separately, I just need to make sure that doesn't break backwards compat

@kolpakov-p
Copy link
Contributor Author

That would be great!

Do you have time to do this in 1-2 weeks, or will my help be needed?

@iiian
Copy link
Owner

iiian commented Nov 9, 2023

I'd love your help! I'm swamped at work this week with some new production rollouts.

If you decide to just implement --map-enum-case without preserving backwards compat that's perfectly fine, we'll just trip a 2.0 version bc there are some people using this in production CI/CD systems.

red-green TDD works pretty well in this repo, haven't had any complaints yet. I think the pattern for test cases is pretty easy to repeat, but let me know if it looks weird. Also, I'm happy to provide some directions on what I think needs to be updated, but my gut feeling is that it'll look pretty clear after a bit.

Oh, and I think both yarn and pnpm work, if you don't want to use npm.

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 a pull request may close this issue.

2 participants