Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Fix migration template (#3015)

Ivan Starkov82a318bb83d7
diff --git a/packages/prisma-client/prisma/migrations/template.txt b/packages/prisma-client/prisma/migrations/template.txt
index c330e9dabd..452ec31fc4 100644
--- a/packages/prisma-client/prisma/migrations/template.txt
+++ b/packages/prisma-client/prisma/migrations/template.txt
@@ -5,15 +5,25 @@ import { PrismaClient } from "./client";
// 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.
//
-// You shouldn't import code that may change later
+// You shouldn't import code that may change later
// and become incompatible with the migration.
// It's better to copy it to the migration directory.
export default () => {
+ if (process.env.DIRECT_URL === undefined) {
+ throw new Error("env variable DIRECT_URL is not defined");
+ }
+
const client = new PrismaClient({
+ datasources: {
+ db: {
+ url: process.env.DIRECT_URL,
+ },
+ },
// Uncomment to see the queries in console as the migration runs
- // log: ["query", "info", "warn", "error"],
+ log: ["query", "info", "warn", "error"],
});
+
return client.$transaction(async (prisma) => {
// This is the body of your migration.
// Use the `prisma` client to perform database operations.