Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
sequelize-cli
Advanced tools
The sequelize-cli package is a command-line interface for Sequelize, a popular Node.js ORM (Object-Relational Mapper). It provides a set of commands to help manage your database schema, migrations, and seed data, making it easier to work with databases in a Node.js environment.
Generating Models
This command generates a new model named 'User' with the specified attributes. It creates a model file and a corresponding migration file.
npx sequelize-cli model:generate --name User --attributes firstName:string,lastName:string,email:string
Running Migrations
This command runs all pending migrations, updating the database schema to match the latest state defined in your migration files.
npx sequelize-cli db:migrate
Creating Seed Data
This command generates a new seed file named 'demo-user'. Seed files are used to populate the database with initial data.
npx sequelize-cli seed:generate --name demo-user
Undoing Migrations
This command undoes the last executed migration, reverting the database schema to its previous state.
npx sequelize-cli db:migrate:undo
Running Seeders
This command runs all seed files, populating the database with the data defined in the seed files.
npx sequelize-cli db:seed:all
Knex.js is a SQL query builder for Node.js that supports multiple database types. It provides a similar migration and seeding functionality as sequelize-cli but does not include an ORM layer. Knex is more focused on query building and database schema management.
TypeORM is an ORM for TypeScript and JavaScript (ES7, ES6, ES5). It supports multiple database types and provides a CLI for managing migrations and generating models. TypeORM offers a more feature-rich ORM experience compared to sequelize-cli.
MikroORM is a TypeScript ORM for Node.js based on the Data Mapper, Unit of Work, and Identity Map patterns. It supports multiple databases and provides a CLI for managing migrations and seeding. MikroORM is designed to be lightweight and fast, with a focus on TypeScript support.
The Sequelize Command Line Interface (CLI)
Make sure you have Sequelize installed. Then install the Sequelize CLI to be used in your project with
npm install --save-dev sequelize-cli
And then you should be able to run the CLI with
npx sequelize --help
Sequelize CLI [Node: 10.21.0, CLI: 6.0.0, ORM: 6.1.0]
sequelize <command>
Commands:
sequelize db:migrate Run pending migrations
sequelize db:migrate:schema:timestamps:add Update migration table to have timestamps
sequelize db:migrate:status List the status of all migrations
sequelize db:migrate:undo Reverts a migration
sequelize db:migrate:undo:all Revert all migrations ran
sequelize db:seed Run specified seeder
sequelize db:seed:undo Deletes data from the database
sequelize db:seed:all Run every seeder
sequelize db:seed:undo:all Deletes data from the database
sequelize db:create Create database specified by configuration
sequelize db:drop Drop database specified by configuration
sequelize init Initializes project
sequelize init:config Initializes configuration
sequelize init:migrations Initializes migrations
sequelize init:models Initializes models
sequelize init:seeders Initializes seeders
sequelize migration:generate Generates a new migration file [aliases: migration:create]
sequelize model:generate Generates a model and its migration [aliases: model:create]
sequelize seed:generate Generates a new seed file [aliases: seed:create]
Options:
--version Show version number [boolean]
--help Show help [boolean]
Please specify a command
All contributions are accepted as a PR.
Please read the contributing guidelines.
FAQs
The Sequelize CLI
The npm package sequelize-cli receives a total of 446,231 weekly downloads. As such, sequelize-cli popularity was classified as popular.
We found that sequelize-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.