Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

2.3.1

Compare
Choose a tag to compare
@Errorname Errorname released this 16 Aug 15:09
· 8 commits to master since this release

In this release:

  • Upgraded Prisma version
  • A new Redwood plugin
  • Allow --schema option
  • More documentation & small stuff

Upgraded Prisma version

This version of Prisma-multi-tenant now comes with Prisma v2.4.1. (See Prisma release notes)

A new Redwood plugin

Redwood is a Framework "Bringing full-stack to the Jamstack", using Prisma to handle your database.

This release introduce a new Redwood plugin, @prisma-multi-tenant/redwood, which adds multi-tenancy:

api/src/lib/db.js:

import { MultiTenant, fromContext } from '@prisma-multi-tenant/redwood'

export const multiTenant = new MultiTenant()
export const db = fromContext()

api/src/functions/graphql.js:

import { multiTenant } from 'src/lib/db'

export const handler = createGraphQLHandler({
  schema: makeMergedSchema({
    schemas,
    services: makeServices({ services }),
  }),
  context: async ({ event }) => ({
    // The name can come from anywhere (headers, token, ...)
    db: await multiTenant.get('my_tenant_A').catch(console.error),
  }),
})

Check out the documentation and example project to learn more on how to add multi-tenancy to your Redwood apps!

Allow --schema option

If your schema isn't placed at the default location (prisma/schema.prisma), you can now use the --schema option on the Prisma-multi-tenant CLI to still be able to find it.

More documentation & small stuff

  • Blitz example app
  • Option to disable creation of example file: pmt init --no-example
  • A change on management sqlite db path resolves. It is now relative the cwd of your app. (You probably need to append with prisma/)