@matthieulemoine/prisma-sequelize-generator

    1.5.2 • Public • Published

    🏳️‍🌈⃤ Prisma Sequelize Generator

    A generator, which takes a Prisma 2 schema.prisma and generates Sequelize Models.

    Generic badge npm version npm downloads build status Code QL Coverage Status semantic-release GitHub license

    Getting Started

    1. Install

    npm:

    npm install prisma-sequelize-generator --save-dev

    yarn:

    yarn add -D prisma-sequelize-generator

    2. Add the generator to the schema

    generator client {
      provider = "prisma-sequelize-generator"
    }

    With a custom output path (./sequelize - default)

    generator client {
      provider = "prisma-sequelize-generator"
      output = "custom-output-path"
    }

    Additional options

    generator client {
      provider = "prisma-sequelize-generator"
      outputFormat = "typescript"
    }

    Supported output formats are javascript (alias js - default) and typescript (alias ts).

    3. Run generation

    prisma:

    prisma generate

    3. Use Sequelize Models to interact with your database

    import { createSequelizeInstance } from './prisma/sequelize';
    
    const { sequelize, models } = createSequelizeInstance({
      ssl: true,
      dialectOptions: {
        connectTimeout: 1000,
      },
    });
    // use `sequelize` instance and `models` in your application to read and write data in your DB

    No need to set a connection string, it is set form the datasource configuration in your schema.prisma by default.

    Supported Node Versions

    Node Version Support
    (Maintenance LTS) 12 ✔️
    (Active LTS) 14 ✔️
    (Current) 16 ✔️

    Install

    npm i @matthieulemoine/prisma-sequelize-generator

    DownloadsWeekly Downloads

    90

    Version

    1.5.2

    License

    MIT

    Unpacked Size

    32.7 kB

    Total Files

    16

    Last publish

    Collaborators

    • matthieulemoine