Git Product home page Git Product logo

Comments (5)

iiian avatar iiian commented on July 20, 2024

My enums defined in PascalCase are not mapped when running prisma-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.

alizeegtd avatar alizeegtd commented on July 20, 2024

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.

iiian avatar iiian commented on July 20, 2024

version 1.7.3 pushed, please pull and retry

from prisma-case-format.

alizeegtd avatar alizeegtd commented on July 20, 2024

@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 avatar iiian commented on July 20, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.