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

When I use sequelize cli to do seed all,but it return error: invalid data?

I use sqlite3 and sequelize. sqlite3 5.0 seqeulize My seed files ERROR: Invalid value { show: true, itemAdd: true, itemsExport: true, itemDelete: true } My users-model contains: itemList:{type:DataTypes.JSON} My seed file: 'use…
radiorz
  • 1,459
  • 4
  • 18
  • 36
0
votes
1 answer

Attach Model to Sequelize Object

It has been a while since I used sequelize and I recently started a new setup with the sequelize-cli tool that appears to have a very templated approach to model generation and I'm trying to determine how I can access my model to make queries. In my…
cphill
  • 5,596
  • 16
  • 89
  • 182
0
votes
1 answer

Create not found when using Sequelize CLI generated model

My approach was like this below command npx sequelize-cli model:generate --name User --attributes name:string,email:string,password:string then it's generated a model file named user.js & file structure like below 'use strict'; const { Model }…
jesica
  • 645
  • 2
  • 13
  • 36
0
votes
1 answer

Sequelize Raw Query returns Array of TextRows

I am using sequelize in my project. I am using the following format to get the results. But each row in the result is returned as textRow. Is it ok if I can directly access using the index or Do I need to convert textrow? Need your…
user846445
  • 221
  • 1
  • 3
  • 14
0
votes
0 answers

Creating Associations between 2 Tables on 2 different Databases with differing host/server - ER_BAD_DB_ERROR

I have 2 different databases, on 2 different servers, with 2 different schemas. Essentially, I want to associate one table in one database to another table in the other database, though I am having some trouble in doing so. I've been able to create…
mcclosa
  • 943
  • 7
  • 29
  • 59
0
votes
1 answer

Get data that contains all the ids of the array

I'm trying to make a filter songs, i have an array of genres ids that i retrieve from the client, i do this for get all the audios from one id: Audio.findAll({ include: [{ model: db.Genres, as: "genres", where: { id: { …
0
votes
0 answers

Sequelize Many to Many not associated problem

I work on an application where users can design their own custom forms. I'm using Sequelize and Postgress. It has an online form where users can create their custom forms. I have two entities where it should show forms for Event and Event Type. The…
Loki
  • 1,064
  • 2
  • 26
  • 55
0
votes
1 answer

Get data by array of ids

I'm trying to make a filter songs for a my project, i have an array of genres ids that i retrieve from the client, i do this for get all the audios from one id: Audio.findAll({ include: [{ model: db.Genres, as: "genres", where: { …
0
votes
1 answer

Which is good practice ? Exposing primary key in db or finding the user with some other unique key?

Here is my scenerio. Am creating an backend with node, express and sequelize for React native mobile app. Lets assume that we have two tables - one is User and another is Wallet ( both are in 1to1 association ). Here is my question, when i need to…
nothingimp
  • 79
  • 7
0
votes
1 answer

Backend issue posting values with Sequelize to MySQL

I have connected Sequelize to MySQL and the app successfully displays the data from my database in Postman and the browser. This is the initial data I inserted directly from the terminal into my database. Now, I want to save new objects into my…
Baulene
  • 29
  • 4
0
votes
2 answers

[SequelizeConnectionRefusedError]: connect ECONNREFUSED 127.0.0.1:3306

Hi I am new with Sequelize ORM. I am following some tutorial and while hands-on, I am facing the problem in connecting the MySQL database with server. ConnectionRefusedError [SequelizeConnectionRefusedError]: connect ECONNREFUSED 127.0.0.1:3306 …
Tanish Gupta
  • 400
  • 2
  • 8
  • 20
0
votes
1 answer

Sequelize: Limit AND Order Eagerly Loaded Associations

I have 4 tables. Users, Rooms, Messages, and a join table RoomUsers. I want to write a query that: 1. Return a list of rooms 2. Each room with the last message sent 3. Rooms ordered by the message last sent The problem is that I'm unable to…
Derrick Mei
  • 97
  • 1
  • 9
0
votes
1 answer

How to add a nested JSONB field with sequelize/postgres

In User model, there is a JSONB field viewer_data which is currently null for instance user. A new field jwt_secret with value 1 needs to be added under viewer_data. It shall look like the following after adding jwt_secret under viewer_data: user…
user938363
  • 9,990
  • 38
  • 137
  • 303
0
votes
1 answer

Node app on Plesk - Environment variables on custom scripts

I'm running a Node v12 app on Plesk Obsidian v18.0.29 I've set the required environment variables in the dedicated section: Also the "Application Mode" should in theory act as NODE_ENV for the process and seems to do so. Just FYI I also tried…
GigiSan
  • 1,170
  • 2
  • 19
  • 30
0
votes
0 answers

ERROR: Could not find migration method: up

I have the up option filed in my seed file, but I couldn't find what the message exactly says. This error occurs when I run the command npx sequelize-cli db:seed:all As per the link here I added the .sequelizerc file as well but it throws same…
Akbar B
  • 43
  • 1
  • 8