edamomous
edamomous
PPrisma
Created by edamomous on 3/8/2025 in #help-and-questions
How to create a new database w/ schema from Node - not CLI?
Hey all, trying to figure a problem out. I'm building a desktop app (Electron, Node, React, Prisma, etc) that will run from user's computer. In my use case users can create multiple instances of the app - think a different savegame in a video game. For this, I would really like to have different databases for each instance - db1.db, db2.db, db3.db, etc. I know how to solve this with storing all the data in one Sqlite db and indexing etc, but would prefer totally different DBs I know how to do all of this from CLI with db push, migrate, and other commands. But can't figure out how to do it from Node itself What I would like to do is if a user creates a new instance, I build a filename and path, then create the new datbase file w/ schema at that location. And a PrismaClient instance is created for it. Is this possible? Most of my searching hasn't been successful. Thanks!
2 replies