I have started my Prisma client and now I want to ...
# orm-help
a
I have started my Prisma client and now I want to switch the DB that I am connected, I was thinking I could just do
prisma.$connect("another-db-name")
but that doesn't seem to work, any ideas? Thanks
r
@Angelo 👋 You can add the DB URL to the
datasources
block as shown here.
a
I guess I need to explain it a bit better, I connect with the "standard" DB and then I want to use the same prisma client to create a database and then connect to it, so I actually can't use the
datasources
property because I don't know the next DB that I'll connect beforehand. Does that make sense?
r
You can create a new database but to connect to it, you would need to instantiate a new
PrismaClient
with the DB URL.
👍 1
a
thanks @Ryan I'm gonna take that approach and create an "admin client"
👍 1