1.0.2 • Published 12 months ago

ts-mig v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

This package is designed to address the issue of generating migrations using the Sequelize CLI in a TypeScript-based project that utilizes Sequelize.

Sequelize is an ORM (Object-Relational Mapping) library for Node.js that provides easy database access and management. Sequelize migrations are used to manage changes in the database schema over time, allowing developers to make alterations without losing existing data. However, using Sequelize with TypeScript can sometimes present challenges when generating migrations through the Sequelize CLI.

The "typescript-sequelize-migration" package aims to simplify this process by providing a solution specifically tailored for TypeScript-based projects using Sequelize. It likely includes custom functionality or modifications to the Sequelize CLI to ensure seamless migration generation and TypeScript integration.

I personally had tested this npm package with Nestjs and typescript and expressjs based project

Note: ct: Create Table

#local installation 
npm i --save-dev ts-mig

#Global installation 
npm i -g ts-mig
    # create a sequelized based migration
    $ ts-mig

    # create a sequelized based migration named migration
    $ ts-mig -n="{migration file name}"

    # create a sequelized based migration named migration
    $ ts-mig -f="{filepath}"

    #another easy way to create npm script
    #copy paste below line in npm scripts
    "create-migration": " ts-mig -f src/db/migrations"

Sequelize-cli

Sequelize

Steps: 1. Create a .sequelizerc file with following content const path = require('path');

  1. Run Command

  2. Configure command in npm script, add following lines in

    run command directly form to create migration file with default file name.

or run command directly form to create migration file and provide file name.