Prisma Schema Transformer

screenshot of Prisma Schema Transformer
prisma

Prisma ORM schema post-processor.

Overview

The Prisma Schema Transformer is a powerful experimental tool designed for Prisma v3, aimed at simplifying the transition from snake_case to camelCase in Prisma schemas. By utilizing the getDMMF method from the @prisma/sdk, it streamlines the post-processing of generated schemas, ensuring that model and field names conform to the camelCase convention. This tool is particularly beneficial for developers who wish to maintain clarity and consistency in their codebase while interfacing with a database that uses snake_case conventions.

Not only does the Prisma Schema Transformer facilitate naming conventions, but it also automates the addition of helpful attributes, such as @updatedAt, when necessary. This makes it an essential utility for developers looking to enhance their productivity by reducing manual work and potential errors in schema manipulation.

Features

  • Snake_case to CamelCase Transformation: Automatically converts snake_case field names to the more readable camelCase format, aligning with JavaScript conventions.

  • Model Name Singularization: Ensures that model names are always singular, promoting best practices in naming and clarity in the schema.

  • Field Name Handling: By default, fields are treated as singular, with special rules for many-to-many relationships, maintaining logical consistency.

  • Automatic @updatedAt Attribute: Adds the @updatedAt attribute to fields that correspond to database columns named updated_at, enhancing schema tracking.

  • Ignore Unwanted Models: Allows users to specify certain models to be ignored during schema processing, giving more control over the final output.

  • Post-Processing Integration: Leverages the getDMMF from @prisma/sdk for extensive post-processing capabilities, creating a more refined schema with minimal effort.

  • Testing and Validation: Includes test fixtures from @prisma/sdk for validating the transformation, ensuring the final schema is reliable and accurate.

  • MIT Licensed: This tool is open-source under the MIT License, promoting community contributions and collaborative development.

prisma
Prisma

Prisma is a server-side library that helps developers read and write data to the database in an intuitive, efficient and safe way.

fullstack
Fullstack

A fullstack boilerplate provides a starter application that includes both frontend and backend. It should include database, auth, payments, user roles and other backend services to build a fully featured saas or webapps.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.