7 days ago
Hello, I am using 2 postgres dbs and have followed -https://www.prisma.io/docs/guides/multiple-databases guide to set them up.
On running yarn dev
I am getting the following error - Error validating datasource db
: the URL must start with the protocol prisma://
or prisma+postgres://
Not sure what is wrong, please help.
0 Replies
7 days ago
That guide is specifically for Vercel. Mind explaining what your goal is here?
My goal is to use one database for app related user info, another for custom content
7 days ago
All the resources I can find online seem very hands on with editing the filesystem, not ideal for Railway. Is there a reason why you don’t want to just run two database clients? Or store all your tables in one database under different datasets?
7 days ago
If you’re willing to run just one database, or two separate database services, setup will be much much easier
I am building a word-learning app, so I have separated the lesson content (words, quiz questions) from the user content (progress, personal info). I thought this would be a more decoupled architecture.
I have two postgres dbs (prisma-app-db, prisma-modules-db) and have created two db clients
`import { PrismaClient } from "../../../prisma-app-database/app-database-client-types"
const getPrisma = () => new PrismaClient()
const globalForAppDBPrismaClient = global as unknown as {
appDBPrismaClient: ReturnType
}
export const appDBPrismaClient =
globalForAppDBPrismaClient.appDBPrismaClient || getPrisma()
if (process.env.NODE_ENV !== "production")
globalForAppDBPrismaClient.appDBPrismaClient = appDBPrismaClient
`
6 days ago
Running two databases is unnecessary, those two topics could easily be different datasets. That’s how I recommend you should proceed here
6 days ago
there’s no point in doubling your database spend for very little benefit
Noob question - please can you tell me in what scenario would it be necessary to have multiple databases vs multiple tables in the same database?
5 days ago
Security reasons, mostly. If you absolutely have to have sensitive data stored in a secure place, it could make sense to have two databases
5 days ago
but realistically, in most cases you can just apply security changes to the less sensitive data too and you’ll be fine
5 days ago
usually there are dataset/table/column level security options. all the more reason to keep all your data in one place
5 days ago
Ah scaling is also a reason. If you’re hitting your database very hard with a ton of queries, it could make sense to have replicas to ease the load
3 days ago
No problem!
3 days ago
!s
Status changed to Solved adam • 3 days ago