Skip to content

westmark/sequelize-multi-tenant-enhancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sequelize Multi Tenant Enhancer

A Proxy based enhancer function which enables schema based multi tenancy in Sequelize.

Installation

yarn add sequelize-multi-tenant-enhancer

Caveats

  • Requires Proxy support
  • Only tested for Sequelize V3

Example code

(Assumes that schemas with tables are already in place)

const enhance = require( 'sequelize-multi-tenant' );

const seq = someFunctionWhichInitializesTheDbAndDefinesAllModels();
const enhancedSeq = enhance( seq );
const clientA = enhancedSeq.withSchema( 'client-a' );
clientA.models.Foobars.findAll()
  .then( ( results ) => {
    ...
  } );

About

Multitenancy enhancer for Sequelize

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published