Home

Awesome

Node.js CI

<p align="center"> <img height="120" src="./assets/hero.png" alt="Prisma Schema DSL" /> </p>

JavaScript interface for Prisma Schema DSL

Installation

npm install prisma-schema-dsl

API

Print

print(schema: Schema): Promise<string>

Prints Prisma schema file from AST. The schema is formatted using prisma-format.

Builders

createSchema(models: Model[], dataSource?: DataSource): Schema

Creates a schema AST object

createEnum(name: string, values: string[], documentation?: string): Enum

createModel(name: string, fields: Array<ScalarField | ObjectField>): Model

createScalarField(name: string, type: ScalarType, isList: boolean = false, isRequired: boolean = false, isUnique: boolean = false, isId: boolean = false, isUpdatedAt: boolean = false, default: | null | boolean | CallExpression | number | string = null): ScalarField

createObjectField(name: string, type: string, isList: boolean = false, isRequired: boolean = false, relationName: string | null = null, relationToFields: string[] = [], relationToReferences: string[] = [], relationOnDelete: "NONE" = "NONE"): ObjectField

createDataSource(name: string, provider: DataSourceProvider, url: string | DataSourceURLEnv): DataSource

Creates a data source AST object

Development


Created with <3 by amplication