#Multiple data sources

1 messages · Page 1 of 1 (latest)

serene bay
#

So I get my db which is a PrismaClient with this piece of code. We also have 2 databases which is up all the time and synced. Are there any way to use multiple database urls so if one fails it will go to the next one?

export const db =
  globalForPrisma.prisma ??
  new PrismaClient({
    log: process.env.NODE_ENV === 'development' ? ['error'] : ['error'],
    // Anyway to use multiple URLs here if one of them is failing
    datasourceUrl: process.env.DATABASE_URL,
  });

if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = db;
versed sapphireBOT
#

Howdy, friend! I'm the Prisma AI Help Bot — fast answers from me, or slow, hand-crafted wisdom from a dev? Choose wisely, adventurer.