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
2
votes
3 answers

sequelize-cli returning 'Unknown arguments' error

In my SailsJS app, when I enter the command into the terminal: sequelize db:seed:all I get the response: Unknown arguments: models, username, password, database, host, dialect Also when I run: sequelize -v I get back: Sequelize CLI [Node: 6.2.1,…
user3143105
  • 129
  • 1
  • 12
2
votes
0 answers

How to get sequelize.ARRAY internal datatype

Node seqeulize supports the postgres ARRAY type. http://docs.sequelizejs.com/variable/index.html#static-variable-DataTypes Say : nameVariations: { type: Sequelize.ARRAY(Sequelize.STRING), allowNull: true, } Let's assume this…
Dory Zidon
  • 10,497
  • 2
  • 25
  • 39
2
votes
1 answer

npm run sequelize cannot resolve

I am trying to use sequelize migration: npm install --save sequelize-cli Then I add this in package.json: "scripts": { "sequelize": "sequelize" }, Then I try: npm run sequelize help:init I got this error: Unable to resolve sequelize package…
Alvin
  • 8,219
  • 25
  • 96
  • 177
2
votes
1 answer

running multiple commands using sequelize cli

I have the following migration file but i get this error: TypeError: queryInterface.addConstraint is not a function Can anyone enlighten me on how this should be written? 'use strict'; const uuidV4 = require('uuid/v4'); module.exports = { up:…
David
  • 10,418
  • 17
  • 72
  • 122
2
votes
1 answer

Sequelize Order By Included Model Property

I'm trying to order by on a belongsToMany relationship. I would like to order by the column firstName of the Subscriptions table, which is returned with the event.getSubscriptions() query. Here's where I'm at right now: return…
Thomas
  • 2,356
  • 7
  • 23
  • 59
2
votes
1 answer

How to SELF JOIN using Sequelize in Node

I'm using sequelize-cli for migrations and have researched different scenarios but there doesn't seem to be a definite solid answer as to how to self join. I want to have a join table called friendships which joins users and friends (which are…
user6823414
2
votes
1 answer

Sequelize Many To Many Relationship : Cannot read property 'split' of undefined

I'm trying to create many to many relationship using Sequelize + nodeJs using existing MySQL Database : Below is my tables : - "usr" Table : usr_id (PK) - Intermediate "usr_role" : usr_id, role_id - "role" table : role_id This is my models "User"…
2
votes
1 answer

Sequelize: Change column type to ENUM

I cannot seem to find the proper way to change a column from a String type to an ENUM while persisting the data in that column. I've also attempted to create a new column with the ENUM type and then copy the data between columns: //…
floatleft
  • 6,243
  • 12
  • 43
  • 53
2
votes
2 answers

Sequelize CLI generate migration files for updated models?

I'm wanting to generate migration files for /models/model_name.js (model) files. Although I haven't found a way todo this yet. So say I created a model articles with just an id field, and then I edited that models/articles.jsfile, how can I use the…
James111
  • 15,378
  • 15
  • 78
  • 121
1
vote
1 answer

How do i do the include in User.findAll() if i have three foreign keys in the table?

I have a user with three foreign keys. Using sequelize how do i get the details of the reference when i use findAll module.exports = (sequelize, DataTypes) => { const User = sequelize.define( 'user', { id: { type:…
1
vote
1 answer

Can anyone explain what is sequelize migration?

I had read and search lot of pages.I don't get it correct explanation what i need. So,anyone can explain it what it is exactly. It will helpful for most of us.Thanks in advance.
1
vote
1 answer

Sequelize | (re)generate migration files from existing models

I'm using Sequelize and I'm currently creating migrations for my nodejs-application. How can I regenerate the migration files when I changed the models? Using npx sequelize-cli model:generate will create a migration file automatically. I want to…
silberfuchz
  • 231
  • 1
  • 2
  • 6
1
vote
0 answers

Asynchronously load configuration for Sequelize CLI

I am using Sequelize CLI to run migrations against out database and I have the following .sequelizerc file // .sequelizerc const path = require('path'); module.exports = { "config": path.resolve('src', 'database', 'config.js'), "models-path":…
lwileczek
  • 2,084
  • 18
  • 27
1
vote
0 answers

Getting err no exports found in module when deployed to vercel

I deployed my nodejs server with sequelize and sequelize cli, when I deploy application to vercel with having folder only index.js in models which is sequelize-cli default folder and file, my app is working fine but when I add new file, for example,…
Mohammad
  • 11
  • 1
1
vote
1 answer

Running sequilize migration with umzug through github ci/cd

im using sequlize with umzug - migrations work locally, when i create a job for it, it cannot find the neccessery modules. I got a mirgrator.js file. const { migrator } = require('./iumzug.js'); migrator.runAsCLI() And an iumzug.ts file as well,…
shahar
  • 89
  • 1
  • 5