fix: fixes 4186
Some database providers, like supabase, provides two URLs to access the database. A main URL behind pgBouncer's for load balancing, and a direct separated URL to perform migrations (running DDL operations), as does not support advisory locks or multi-statement DDL required by migrations. Before v3.1.0, adding `directUrl` along with `url` to `prisma/schema.prisma` was enought. Now, I'm making a commit to use direct url when set
This commit is contained in:
+2
-1
@@ -67,7 +67,8 @@ async function checkDatabaseVersion() {
|
|||||||
|
|
||||||
async function applyMigration() {
|
async function applyMigration() {
|
||||||
if (!process.env.SKIP_DB_MIGRATION) {
|
if (!process.env.SKIP_DB_MIGRATION) {
|
||||||
console.log(execSync('prisma migrate deploy').toString());
|
const directUrl = process.env.DIRECT_DATABASE_URL || process.env.DATABASE_URL;
|
||||||
|
console.log(execSync('prisma migrate deploy', { env: { ...process.env, DATABASE_URL: directUrl } }).toString());
|
||||||
|
|
||||||
success('Database is up to date.');
|
success('Database is up to date.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user