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

Sequelize / Postgres. Date Array Input Being Read as Text Array

I'm trying to seed my database, and one of my model's attributes is of type Date Array(timestamp with time zone). I end up getting this error: column "myDate" is of type timestamp with time zone[] but expression is of type text[] It works fine with…
Bousha
  • 11
  • 1
  • 3
0
votes
1 answer

troubles deploying with diigtal ocean node sequelize

Im trying to make a deploy in Digital Ocean when i try to make a migration using sequelize cli but wehn i do it npx sequelize db:migrate its says a error in the terminal and says ERROR: Cannot find "/home/deploy/app/config/config.json". Have you…
Dario Coronel
  • 119
  • 2
  • 10
0
votes
1 answer

Sequelize belongToMany cascade delete

Good day, everyone. I have two tables (Project, Configuration) that are connected as belongsToMany (ProjectConfigurations). I need to delete the project (Project) and, as a result, I need to delete Configurations that are connected with this…
MuffinColor
  • 21
  • 1
  • 5
0
votes
2 answers

Disable sequelize column returning

Good afternoon, everyone. I have a database with users' secret information. I want to disable returning of column "password" when I use findOne(). How can I do it without deleting it from the response object?
MuffinColor
  • 21
  • 1
  • 5
0
votes
1 answer

How to fix sequelize connection issue while generating index.js?

I new in node.js and have some problems with sequelize-cli. I have sequelize model and while I run the project, i get error in my index.js: const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes); TypeError: require(...) is…
0
votes
1 answer

Sequelize CLI error during create model in project dtabase

I got a message during creating a model through sequelize in MySQL databse. It shows a message Missing required argument: attributes PS C:\Users\user\Downloads\codeways-backend> sequelize model:create --name Category --attribute 'name:string'…
0
votes
1 answer

Sequelize database model are coming back as (function [anonymous])

I have been trying to do a findall route from my sequelize database models Accounts and Dogs: db.Accounts.findAll({ where: { admin:true, }, include: [db.Dogs] }).then((dbAdminAcc) =>…
GKFitz
  • 1
0
votes
1 answer

Sequelize include options cannot get another models

I have two model that are belongs to each other (order_items.js & products.js) productId as a foreign key in order_items, code as below: order_items.js const { DataTypes } = require('sequelize') const db_config = require(`../config/config`) const…
Muhammad Haekal
  • 477
  • 6
  • 22
0
votes
1 answer

How can i to disable step CREATE SCHEMA to sequelize migrations?

I have a postgresql database, schema and username:password. If i run: sequelize db:migrate --config=./dist/options/db.options.js --migrations-path=./dist/migrations --env=main ...then i catch error: CREATE SCHEMA IF NOT EXISTS…
0
votes
1 answer

Sequelize Association with alias "addresses" does not exist on User

I was doing a tutorial with node, MySQL and Sequelize everything was going well but there came a point where I can't get out of this error: "Error: Association with alias" addresses "does not exist on User" has anyone been there? Follow my code:…
Supersan
  • 5
  • 4
0
votes
1 answer

sequelize get error when defining association

im trying to define sequelize association but get error when defining hasMany relationship error throw new Error(${this.name}.hasMany called with something that's not a subclass of Sequelize.Model); its one to many relationship between account and…
0
votes
1 answer

Sequelize is searching table in plural form when calling from ManytoMany relationship

My 'House' table is in singular form and I want to get the data using ManytoMany Relationship but sequelize is considering 'House' table as 'Houses' and cannot fetch the results(i.e []) calling this like, db.V1_DB.models.Users.findAll( …
0
votes
1 answer

Sequelize. How to set OnUpdate to NO ACTION when creating a foreign key with migration

I'm new to nodejs. I have created a template with expressJs. For migration and ORM purposes I am using squelizeJs with mysql2 plugin. I have created migrations and models for my tables. But I could not change the default behavior when creating…
0
votes
1 answer

Node JS API Sequelize PostgreSQL UUID as primary key return error "column Nan does not exist"

I'm working on a REST API for the backend of a simple e-commerce app using Node JS, PostgreSQL and Sequelize, and I'm facing an issue with Sequelize when I try to add a product to the shopping cart. It returns an error "column Nan does not exist"…
0
votes
0 answers

Does sequelize create constraints in the database?

First of all, im used to work with Django as ORM framework, and django handles everything for me... creating of constraint, tables and etc... but when i saw that sequelize is a ORM framework i decided to give a change in one project mine using…
Diego Vinícius
  • 2,125
  • 1
  • 12
  • 23