prismany
v1.0.2
Published
Query any number of databases with Prisma
Readme
Prismany
Query any number of databases with Prisma

Commands
Generate
npx prismany generate
Generates a Prisma client for every schema in your
./prismadirectoryClients can be imported via
import { PrismaClientSchemaName, PrismaClientSchemaName2 } from '@prismany/client';- Eg:
./prisma/myCoolDb.prismacan be imported from:
import { PrismaClientMyCoolDb } from '@prismany/client';- Eg:
Note: The
generatecommand will add a"client.output"path to each of your.prismafiles
Push
npx prismany push
Runs
prisma db pushagainst all of your schemasIf any
pushfails, or requires confirmation, the command will terminate and you'll need to push the individual schema manually:npx prisma db push --schema=./prisma/myDb.prisma
Other
If you'd like to see other Prisma features supported, like migrate, please open an issue.
Client Types
You can access your model types, and ORM input types like so:
// prisma client
import { PrismaClientDb1 } from '@prismany/client';
// advanced model, input types
import { Prisma, MyModel } from '@prismany/client/db1';
const db = new PrismaClientSomeDb1();
const createModelInstance = (data: Prisma.MyModelCreateInput): Promise<MyModel> => {
return db.myModel.create({ data });
};How it works
This CLI takes an approach similar to this wonderful answer on Prisma's Github. It uses the client.output path in your Prisma schema to make sure clients don't overwrite each other.
Prismany automates much of the manual effort involved in that approach, and crucially, reuses the same engine binary for all clients.
This brings each client from a minimum of 15MB down to just 460kB each.
Example app
https://github.com/JoeRoddy/prismany-example
