Questions tagged [sequelize-cli]

The Sequelize Command Line Interface (CLI) supports for migrations and seeders.

The Sequelize Command Line Interface (CLI) supports for migrations and seeders.

With migrations and seeders it's possible to transfer an existing database into another state and vice versa: those state transitions are saved in migration storage and seeder storage accordingly, which describe the way how to get to the new state and how to revert the changes in order to get back to the old state.

Useful links:


Related tags:

499 questions
0
votes
1 answer

Is migration file must in Sequelize?

I started my project with sequeliz-cli by running init command. but i deleted the migrations and seeder folder. and started creating the models. i need to first create a db in workbench, and then ran db.sync() from sequelize, which created the…
Shubham Shaw
  • 841
  • 1
  • 11
  • 24
0
votes
0 answers

ERROR: Row size too large (> 8126). SEQULIZE

i got error while working with sequlize-cli, i executed the command sequelize db:migrate and it returned the following error ERROR: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of…
Adeojo Emmanuel IMM
  • 2,104
  • 1
  • 19
  • 28
0
votes
1 answer

Where sequelize-cli keeps seeds' list?

I created a script which immidiately creates all necesserily files and code lines for model. So among others my script is creating migration file for model and seed file for model. With migration file i have no problem - npx sequelize db:migrate…
Dmitry Reutov
  • 2,995
  • 1
  • 5
  • 20
0
votes
1 answer

How can I automatically create a new record in a database when another one is created using Sequelize.js?

I am using Sequelize version 5 as my ORM with a User and Profile model defined. There is a one to one relationship between the two models, and I would like for a profile to be automatically created when a user is created. How can I accomplish this?…
0
votes
1 answer

Why is my Sequelize query so slow? (nested-joins using findAll)

I'm seeing an issue where my query is exponentially slower as I include more of the DayAvailability nested associations on the Schedule model. The goal is to serialize the User instance to include all associated instances. Here is the table…
user3386826
  • 327
  • 8
  • 19
0
votes
0 answers

Start migrations from an existing db

I have a db which was created like this: const UserModel = db.define('user', { id: { type: Sequelize.STRING, unique: true, primaryKey: true }, firstName: { type: Sequelize.STRING, }, lastName: { type: Sequelize.STRING }, username: { type:…
perrosnk
  • 835
  • 2
  • 13
  • 23
0
votes
1 answer

Does sequelize have an equivalent of mysqls replace function?

The question is self-explanatory. Replace: works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted So the query i'd…
prof chaos
  • 404
  • 3
  • 18
0
votes
1 answer

Node Js Migration issue (Unhandled rejection SequelizeDatabaseError Specified key was too long )

I am using Sequelize package for database migration in Node js Database is ber 15.1 Distrib MariaDB 10.1.44-MariaDB When I run 'npm run start', got this error this is my migration file code 'use strict'; module.exports = { up: (queryInterface,…
ExpertWeblancer
  • 1,368
  • 1
  • 13
  • 28
0
votes
0 answers

Sequelize bulk create that doesn't fail if one row fails

Is it possible to create a bulk create that will not fail if any of the rows fail and returns all the rows which failed to insert into the database. ex: I am inserting 1000 users into database, 10 of them fail, can I get details of those 10 failed…
sharad shetty
  • 342
  • 2
  • 5
0
votes
1 answer

Sequelize $ne is not working like expected

I'm using mysql, when I try to run this query: Order.findAll({ where: { end_date: { $ne: null, }, }, }); The where clause it generates looks like this: where: "`Order`.`end_date` = '2020-03-11 03:00:00' I tried using $nin and…
0
votes
2 answers

ERROR: Cannot add foreign key constraint when migrating db with Sequelize

When trying to execute the command line 'sequelize db:migrate' I've got the following error: ERROR: Cannot add foreign key constraint I have checked my models and migration files and I could not find anything. Do you know what this error means?…
Atalaia
  • 45
  • 1
  • 6
0
votes
1 answer

Saving JSON object in sequelize

I am trying to save a json object that is sent by a client, in the database The application can handle requests just fine, but i am stuck when it comes to saving the request data in the database, i am using sequelize. Here are my models: Schedule…
0
votes
2 answers

sequelize-cli db:migrate "hangs" adding a check constraint to a newly-added column

I have the following migration file: 'use strict'; module.exports = { up: (queryInterface, Sequelize) => { return queryInterface.sequelize.transaction(t => { return queryInterface.addColumn('Vendors', 'status',…
markvgti
  • 4,321
  • 7
  • 40
  • 62
0
votes
0 answers

How to handle Database Connection Error while running app using Sequelize?

I am having an issue that if Node server application is already running using Sequelize, then Database server has been crashed then it also close node process, how to handle it ? I also checked on Sequelize repo issue…
Ritesh Arora
  • 57
  • 11
0
votes
1 answer

Run pending seeders

I'm going to store seeder history into sequelizedata table. Is there a way to run pending seeders? Right now, regarding to sequelize --help there is only: db:seed - runs specific seeder db:seed:all - runs all seeders Neither of both are working
BartusZak
  • 1,041
  • 14
  • 21