Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prisma-case-format

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prisma-case-format

Give your introspected schema.prisma sane casing conventions

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19K
increased by17.74%
Maintainers
1
Weekly downloads
 
Created
Source

prisma-case-format

As of prisma@2.19.0, prisma introspect will name its model 1:1 with your database's conventions. That's great, but if your db is purely snake_case, or worse if your tables lack any common convention, it can make the autogenerated client code less pleasant to consume. prisma-case-format will format your table and field names for every model as to enforce a more conventional experience.

Usage

❯ prisma-case-format --help
Usage: prisma-case-format [options]

Give your schema.prisma sane naming conventions

Options:
  --file <file>             schema.prisma file location (default: "schema.prisma")
  --table-case <tableCase>  case convention for table names. allowable values: "pascal", "camel", "snake" (default: "pascal")
  --field-case <fieldCase>  case convention for field names. allowable values: "pascal", "camel", "snake" (default: "camel")
  -D, --dry-run             print changes to console, rather than back to file (default: false)
  -h, --help                display help for command

Example

// schema.prisma before
...
model house_rating {
  id       Int    @id @default(autoincrement())
  house_id String
  house    house  @relation(fields: [house_id], references: [id])
  ...
}
...
model house {
  id  String  @id @default(uuid())
  house_ratings house_rating[]
  ...
}
...
❯ prisma-case-format
✨ Done.
// schema.prisma after
...
model HouseRatings {
  id       Int    @id @default(autoincrement())
  houseId  String @map("house_id")
  house    House  @relation(fields: [houseId], references: [id])
  ...

  @@map("house_ratings")
}
...
model House {
  id           String        @id @default(uuid())
  houseRatings HouseRating[]
  ...

  @@map("house")
}
...

FAQs

Package last updated on 15 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc