Wondering what’s next for npm?Check out our public roadmap! »

    sequelize-multi-tenant-enhancer

    1.0.4 • Public • Published

    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 ) => {
        ...
      } );
    

    Install

    npm i sequelize-multi-tenant-enhancer

    DownloadsWeekly Downloads

    1

    Version

    1.0.4

    License

    ISC

    Last publish

    Collaborators

    • avatar