From eed991b7fec103e2e30a5d15203d441a64fb7dbe Mon Sep 17 00:00:00 2001 From: Roman Pominov Date: Fri, 9 Sep 2022 15:03:39 +0300 Subject: [PATCH] add note about imports to template --- .../prisma-client/prisma/migrations/template.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/prisma-client/prisma/migrations/template.txt b/packages/prisma-client/prisma/migrations/template.txt index b619457af1..7ca8fddd80 100644 --- a/packages/prisma-client/prisma/migrations/template.txt +++ b/packages/prisma-client/prisma/migrations/template.txt @@ -1,5 +1,18 @@ import { PrismaClient } from "./client"; +// NOTE ON IMPORTS: +// +// You shouldn't import any code that can change as the project evolves! +// +// It should be safe to import a library like `uuid` as its API is unlikely to change. +// For application code, it's better to copy it to the migration directory. +// +// If you have to import something that may change, +// be prepared to keep the migration code up to date as well. +// +// This is necessary because we want to be able to run old migrations at any point. +// For example, when we setting up a fresh database or making a reset. + export default () => { const client = new PrismaClient(); return client.$transaction(async (prisma) => {