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

AWS RDS - ERROR: Access denied for user 'geornalAdmin'@'%' to database 'mysql' When trying to migrate using sequelize-cli

I just created an AWS RDS database and I need to create the necessary tables for my project. When I tried doing sequelize db:migrate I get ERROR: Access denied for user 'geornalAdmin'@'%' to database 'mysql'. I tried the steps shown at…
Enes T.
  • 137
  • 2
  • 12
0
votes
1 answer

Running Sequelize Migration and Node Server in Same Command Won't Start Server Up

If I try to run my sequelize migrations and then run my Node server in the same command, I run into the issue of my server never starting up. If the migrations have already been run before, the sequelize db:migrate command doesn't go past the "No…
developthewebz
  • 1,827
  • 3
  • 17
  • 43
0
votes
1 answer

Sequelize association not syncing with model definition

'use strict'; module.exports = (sequelize, type) => { const article_comment = sequelize.define('article_comments', { // attributes id: { type: type.INTEGER, primaryKey: true, autoIncrement: true }, …
calimses
  • 301
  • 4
  • 16
0
votes
1 answer

Sequelize throwing: "relation "users" does not exist"

I have a User model that has a hasMany association with my Item model: module.exports = (sequelize, DataTypes) => { const User = sequelize.define('User', { first_name: DataTypes.STRING, last_name: DataTypes.STRING, email:…
Bruno
  • 6,211
  • 16
  • 69
  • 104
0
votes
1 answer

Sequelize uses old table name even after changing table name in sequelize migration

I have updated my table name (from 'StaffMembers' to 'staff' )before running sequelize migration and created a table in postgres db with new name successfully. but when i try to insert a user sequelize still refer old tabel name. Executing…
0
votes
1 answer

Sequelize-cli: Pre-run another seed file before seeding a file?

I have created a seeder file using sequelize-cli to bulkInsert data into a mysql db and it works all fine. However, one of the fields(userId) that i'm inserting is a value present in another table(User). What I was planning to do is - Run a seed…
Nikhil Nanjappa
  • 6,454
  • 3
  • 28
  • 44
0
votes
1 answer

How to set timezone to "-03:00", sequelize cli

I live in Brazil and i want to change timezone to -03:00, but that code doesn't work File:config.json. "development": { "username": "root", "password": "", "database": "sequelize_cli", "host": "127.0.0.1", "dialect": "mysql", …
0
votes
1 answer

Sequelize generates sql query which is getting error

I am getting the following error. The generated query is given below. Error Code: 1054. Unknown column 'country.countryId' in 'field list' 0.0054 sec My all table columns look likes snake_case. Table model declaration is given below. export…
0
votes
2 answers

How to use findAll with associations in Sequelize

I'm having problems to use the findAll() method with associations from Sequelize. I have two models: Posts and Authors (an author has many posts and one post has one author), that I have created with Sequelize-cli and then through the migration…
0
votes
1 answer

Question about Sequelize database migrations

I’m using Sequelize as an ORM for a Postgres database. I started learning & using Sequelize migrations and seeding features. So for I understood that the primary purpose of migrations is to reliably make changes to the database schema without…
0
votes
1 answer

How execute sequelize-cli without overwrite configurations

what best way to execute migrations and seeds on docker with sequelize-cli? Every time i run sequelize-cli init the configuration files is overwrite and are writes with default configurations and i lose my configurations file write in typescript to…
0
votes
1 answer

Sequelize can create data but can't get data from Models

I'm unable to understand what actually is wrong with my code. But I know there is a problem in how I'm implementing Promise. As Shipment.findAll() returns a Promise, and I'm creating a promise again for my router to consume. Then why createShipment…
Maher Shahmeer
  • 148
  • 1
  • 10
0
votes
2 answers

How export database with sequelize

I'm creating migrations for my existing mysql database. I like to backup my target database before running migration. Is there any sequelize-cli commad like npx sequelize-cli db:backup? Or any other methods? I can't find it in sequelize cli…
Freddy Daniel
  • 602
  • 11
  • 25
0
votes
0 answers

sequelize self association error Aliased associations must have unique aliases

I'm using sequelize 4.32 and I was trying to write a self-association in one of the tables, I'm not sure if there is something else that I need to do to solve this relation, my goal is to get all the records in my table and include all the records…
0
votes
1 answer

Sequelize: inputValue cannot be an array or an object

I'm trying to create an instance with associations. I am passing instances of multiple creates to pass down its values. const newTemplate = await productTemplate.create({ friendlyName, isActive: true, productCode, …
Darron
  • 323
  • 4
  • 14