Skip to content

basalt / tenancy-prisma/src / prismaTenantSource

Function: prismaTenantSource() ​

> prismaTenantSource(client, options?): PrismaTenantSource

Defined in: tenancy-prisma/src/index.ts:265

Wire the tenant source to your Prisma client, ready for tenancyPlugin:

ts
const tenants = prismaTenantSource(prisma) // on MySQL: prismaTenantSource(prisma, { columnLimits: 'mysql' })
await tenants.create({ id: 'acme', name: 'Acme', domains: ['app.acme.com'] })
tenancyPlugin({ source: tenants, resolvers: [subdomainResolver({ base: 'localhost' })] })

Parameters ​

client ​

PrismaTenancyClient

options? ​

PrismaTenantSourceOptions = {}

Returns ​

PrismaTenantSource

Released under the MIT License.