30 lines
892 B
TypeScript
30 lines
892 B
TypeScript
|
|
import { defineConfig } from "prisma";
|
||
|
|
import { PrismaPg } from "@prisma/adapter-pg";
|
||
|
|
import { Pool } from "pg";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Prisma 7 Configuration
|
||
|
|
*
|
||
|
|
* This configuration file is required for Prisma 7+ where the datasource URL
|
||
|
|
* is no longer specified in schema.prisma. Instead, connection configuration
|
||
|
|
* is provided here for migrations and in the PrismaClient constructor for runtime.
|
||
|
|
*
|
||
|
|
* @see https://pris.ly/d/config-datasource
|
||
|
|
* @see https://pris.ly/d/prisma7-client-config
|
||
|
|
*/
|
||
|
|
export default defineConfig({
|
||
|
|
earlyAccess: true,
|
||
|
|
schema: "./schema.prisma",
|
||
|
|
migrate: {
|
||
|
|
adapter: async () => {
|
||
|
|
const connectionString = process.env.DATABASE_URL;
|
||
|
|
if (!connectionString) {
|
||
|
|
throw new Error("DATABASE_URL environment variable is required for migrations");
|
||
|
|
}
|
||
|
|
const pool = new Pool({ connectionString });
|
||
|
|
return new PrismaPg(pool);
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|