Query any number of databases with Prisma
npx prismany generate
-
Generates a Prisma client for every schema in your
./prismadirectory -
Clients 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
npx prismany push
-
Runs
prisma db pushagainst all of your schemas -
If 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
If you'd like to see other Prisma features supported, like migrate, please open an issue.
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 PrismaClientDb1();
const createModelInstance = (data: Prisma.MyModelCreateInput): Promise<MyModel> => {
return db.myModel.create({ data });
};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.
