LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

sequelize

Sequelize ORM migration and model CLI

TLDR

Initialize sequelize
$ npx sequelize-cli init
copy
Create model
$ npx sequelize-cli model:generate --name [User] --attributes [name:string,email:string]
copy
Run migrations
$ npx sequelize-cli db:migrate
copy
Undo last migration
$ npx sequelize-cli db:migrate:undo
copy
Create seed
$ npx sequelize-cli seed:generate --name [demo-user]
copy
Run seeds
$ npx sequelize-cli db:seed:all
copy
Create migration
$ npx sequelize-cli migration:generate --name [add-column]
copy

SYNOPSIS

sequelize-cli command [options]

DESCRIPTION

sequelize-cli manages Sequelize ORM projects, providing scaffolding for models, migrations, and seed files. The init command creates the standard project structure with config, models, migrations, and seeders directories.Models define database table mappings with typed attributes, and the CLI generates both the model file and an initial migration. Migrations version the database schema using up and down functions, allowing incremental schema changes that can be applied or reverted. Seeds populate tables with initial or test data.The CLI supports PostgreSQL, MySQL, MariaDB, SQLite, and Microsoft SQL Server through Sequelize's database abstraction layer.

PARAMETERS

init

Initialize project.
model:generate
Create model.
db:migrate
Run migrations.
db:migrate:undo
Revert migration.
seed:generate
Create seed file.
db:seed:all
Run all seeds.
migration:generate
Create migration.
--name NAME
Model/migration name.
--attributes ATTRS
Model attributes.

CONFIGURATION

config/config.json

Database connection configuration for development, test, and production environments, specifying host, port, username, password, dialect, and database name.
.sequelizerc
Project-level configuration file overriding default paths for models, migrations, seeders, and config directories.

CAVEATS

Node.js ORM. Database-specific syntax may vary. Migration ordering is important.

HISTORY

Sequelize is a Node.js ORM supporting PostgreSQL, MySQL, SQLite, and others. The CLI provides scaffolding and migration tools.

SEE ALSO

node(1), npm(1), knex(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid