Error validating datasource
db

spidertwin2
HOBBY

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.

Solved$10 Bounty

0 Replies

spidertwin2
HOBBY

7 days ago

58e6dbe2-4d01-4671-8fd7-1567fce84234


7 days ago

That guide is specifically for Vercel. Mind explaining what your goal is here?


spidertwin2
HOBBY

7 days ago

I just realized, I should ask this in the prisma discord channel


spidertwin2
HOBBY

7 days ago

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


spidertwin2
HOBBY

6 days ago

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.


spidertwin2
HOBBY

6 days ago

I have two postgres dbs (prisma-app-db, prisma-modules-db) and have created two db clients


spidertwin2
HOBBY

6 days ago

`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
`


spidertwin2
HOBBY

6 days ago

1388829457326014500
1388829457678074000


spidertwin2
HOBBY

6 days ago

Both my postgres db services are running on railway


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


spidertwin2
HOBBY

5 days ago

Ohh! I will definitely look into this! Thanks


spidertwin2
HOBBY

5 days ago

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


spidertwin2
HOBBY

3 days ago

Got it! Thanks for the timely help 🙏


3 days ago

No problem!


3 days ago

!s


Status changed to Solved adam 3 days ago


Error validating datasource `db` - Railway Help Station