UNPKG

prisma-util

Version:

Prisma Util is an easy to use tool that merges multiple Prisma schema files, allows extending of models, resolves naming conflicts both manually and automatically and provides easy access to Prisma commands and timing reports. It's mostly a plug-and-play

28 lines (27 loc) 1.05 kB
import AbstractCreator from "./creator.js"; import { SchemaCreator } from "./index.js"; import Model from "./model.js"; /** Enum that will be created in your Prisma schema. * * When resolving conflicts, this enum will be displayed as `codeSchemas:[EnumName]` so you can differentiate between .schema files and code generated models. * * For additional functionality, you can use the same format (`codeSchemas:[ModelName].[columnName]`) to remap columns using the Automatic Remapper. */ export default class Enum extends AbstractCreator { /** Reference to creator for handling chaining. */ private creator; /** Enum name. */ _name: string; /** List of items. */ items: string[]; constructor(creator: SchemaCreator, name: string); /** Change this enum's name. */ name(name: string): this; /** Add an enum item. */ item(name: string): this; model(name: string): Model; enum(name: string): Enum; /** You should not call this method yourself. */ beforeBuild(): this; build(): string; }