npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sequelize-mig

v3.1.3

Published

Sequelize migration generator and es6 init tool

Downloads

28,435

Readme

Sequelize migration generator (and es6 init tool) - sequelize-mig

npm node Build Status Snyk Vulnerabilities for GitHub Repo LGTM Grade

semantic-release Contribution-Welcomed Community Chat

Warning: THIS TOOL IS UNDER DEVELOPMENT AND NOT INTENDED TO PRODUCTION USE RIGHT NOW!!!!

The tool is built using es6 And its not intended to replace sequelize-cli its just completing it

This tool provide these commands:

  • migration:make or migration:add - to create new migrations by comparing new version of your modules to old ones
  • migration:undo or migration:revert - delete last migration file and return to backup state file of the models
  • migration:sync - Sync the models schema file with current models without migrating (Planned)

Planned:

  • init - tool to init required files for sequelize using new es6 schema (Planned)

Install

(Globally - Recommended)

npm install sequelize-mig -g / yarn global add sequelize-mig

Or

(devDependencies)

npm install sequelize-mig -D / yarn add sequelize-mig -D

Usage

For New Users

  • Init sequelize, with sequelize-cli, using sequelize init (or using es6 init by sequelize-mig -Planned-)
  • Create your models manually or using sequelize-cli (or using es6 init by sequelize-mig -Planned-)
  • Create initial migration:
sequelize-mig migration:make -n <migration name>
  • To preview new migration, without any changes, you can run:
sequelize-mig migration:make --preview
  • Finally run migration using sequelize-cli sequelize db:migrate
  • You can use --help to view help of the tool or specific command

For Old Users

If you already used migrations before knowing this tool you can easily fully migrate in the sequelize-cli tool and then run migration:sync and tool will update _current.json and you can continue using this tool normally

Limitations

The migration:make tool supports auto detecting these actions

dropTable, removeColumn, removeIndex,
createTable, addColumn, addIndex,
changeColumn

and Im trying to find a way to know old column name to implement renameColumn because it's now translated to removeColumn then addColumn

Explanation

The tool works by getting the schema of the models into _current.json and every time you run migration:make the tool will compare this file with new schema and write the new migration file then this tool cant actually know if you deleted, or migrated or whatever you edited to these files...

Notes

  • You will be able to make index and modules as es6 but keep migration files as es5 because sequelize-cli isn't compatible with it yet.
  • migration:make tool creates _current.json and _current_bak.json files in migrations dir, these are used to calculate difference to the next migration. Do not remove them!
  • Tool create new migration with name {timestamp}_{name}.{js|cjs} but you can change every single option with parameters

TODO

  • Allow init using es6 modules
  • Adding renameColumn in some way I didn't know until now (maybe comments)
  • auto add renameColumn conversion when edits are only to letters case or adding _

Credits

  • Depending on Scimonster/sequelize-auto-migrations which is forked from flexxnn/sequelize-auto-migrations
  • The main projects are not maintained any more