JavaScript interface for Prisma Schema DSL
npm install prisma-schema-dsl
Prints Prisma schema file from AST. The schema is formatted using prisma-format.
Creates a schema AST object
- Creates an enum AST object
- Validates given name argument
- Creates a model AST object
- Validates given name argument
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
- Creates a scalar field AST object
- Validates given name argument
createObjectField(name: string, type: string, isList: boolean = false, isRequired: boolean = false, relationName: string | null = null, relationToFields: string[] = [], relationToReferences: string[] = [], relationOnDelete: "NONE" = "NONE"): ObjectField
- Creates an object field AST object
- Validates given name argument
createDataSource(name: string, provider: DataSourceProvider, url: string | DataSourceURLEnv): DataSource
Creates a data source AST object
- Clone the repository
git clone [email protected]:amplication/prisma-schema-dsl.git
- Make sure to use npm@7
npm i -g npm@7
- Install the dependencies
npm install
- Run tests
npm test
Created with <3 by amplication