Conventions & Standards
This page will provide details on configuration recommendations, as well as define some standards for how you should interact with Prisma Util for an adequate developer experience.
Paths & Denoting Paths
Paths that define a file in the same directory as the configuration file should not start with . and should follow this example instead:
. and should follow this example instead:You shouldn't use paths in upper directories, but follow a downwards hierarchy instead:
Always use constant values instead of defining your paths in 2 places:
// ❌ Don't create paths like this:
export default {
includeFiles: ["models/post/Post.prisma"],
// rest of your configuration
excludeModels: ["models/post/Post.prisma:Comment"]
};
// ✅ Create paths like this:
const PostPrisma = "models/post/Post.prisma";
export default {
includeFiles: [PostPrisma],
// rest of your configuration
excludeModels: [`${PostPrisma}:Comment`]
};
/*
Bonus points: Use the constant functions from prisma-util/schema-creator
These constant functions can only be used in Prisma Util v2.0.0+.
More information about prisma-util/schema-creator can be found here:
If you want to configure generators instead, use constantGenerator.
https://prisma-util.gitbook.io/modules/schema-creator
*/
import { constantModel } from "prisma-util/schema-creator";
const PostPrisma = constantModel("models/post/Post.prisma");
export default {
includeFiles: [PostPrisma],
// rest of your configuration
excludeModels: [PostPrisma("Comment")]
};Last updated