Notes for Week 8 of 2021

In my last pre-lockdown week, I was focused on moving forward some backend functionality. I went into a rabbit hole of different sync algorithms and making next.js work well with replicated databases.

Random

Replicated Databases

  • In Prisma ORM, you can create multiple clients against different databases sharing the same schema by passing the connection string to a PrismaClient
import { PrismaClient } from '@prisma/client'
const client1 = new PrismaClient({
    datasources: {
        mydb: {
            url: 'postgres://user:password@host/dbname'
        }
    }
}

const client2 = new PrismaClient({
    datasources: {
        mydb: {
            url: 'postgres://user:password@differenthost/dbname'
        }
    }
}

Published in Weekly Notes and tagged


All texts written by . I'd love to hear your feedback. If you've liked this, you may want to subscribe for my monthly newsletter, RSS , or Mastodon. You can always return to home page or read about the site and its privacy handling.