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

Why doesn't sequelize-cli include the ID in the model file?

When I run the following command: sequelize-cli model:create --name User --attributes "dispName:string,email:string,phoneNum1:string" I end up with the following migration file: 'use strict'; module.exports = { up: (queryInterface, Sequelize) =>…
markvgti
  • 4,321
  • 7
  • 40
  • 62
0
votes
1 answer

Customizing sequelize-cli generated IDs

Created a model using: sequelize-cli model:create --name User --attributes "dispName:string,email:string,phoneNum1:string,vendorId:integer" Which resulted in the following migration: 'use strict'; module.exports = { up: (queryInterface,…
markvgti
  • 4,321
  • 7
  • 40
  • 62
0
votes
1 answer

Sequelize Query Execution In Loop

Below iam calling addUpdateDailyLeads with an array like [{ "yyyymmdd": "20191124", "admin_login":"rasheed.s", "category":"PO", "amount":10, "office_id":10000, "new_leads_attempted":10 }, { "yyyymmdd": "20191124", …
0
votes
1 answer

user.validatePassword is not a function

var bcrypt = require('bcrypt-nodejs'); module.exports = (sequelize, DataTypes) => { const user = sequelize.define('user', { email: DataTypes.STRING, password: DataTypes.STRING, status: DataTypes.INTEGER }, {}); user.associate =…
Ravi Rathore
  • 161
  • 1
  • 10
0
votes
1 answer

Sequelize and Postgres - foreign key constraint "..." cannot be implemented

I'm trying to add two foreign keys into my transaction table, one of then works just fine, but the second can't be implemented. Is there a way to set an array of foreign keys? I suppose the problem is the array, since it's the only thing…
0
votes
2 answers

Sequelize database error colum name does not exists

The problem is a findAll product a select with a column which does not exist "PermissionId" I don't understand why sequelize generate this column. The error are: Unhandled rejection SequelizeDatabaseError: column "PermissionId" does not exist …
HoloZoR
  • 3
  • 1
  • 2
0
votes
3 answers

Invalid or unexpected token in creating model with Sequelize-cli

I`m in the right path, but it is resulting in error Windows command line: npx sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string,password:string output: Invalid or unexpected token
0
votes
1 answer

Could not find migration method: up

I am unable to migrate my models to MySQL db. It's throwing me the below error: Loaded configuration file "config\config.json". Using environment "development". (node:5828) [SEQUELIZE0004] DeprecationWarning: A boolean value was passed to…
Reet Pratayay
  • 11
  • 1
  • 5
0
votes
2 answers

How to automatically create migration files when using sequelize?

Is it possible to automatically create migration files when using sequelize? For example if I change my model, is there a way to automatically create a migration file that reflects those changes and run the migration to effect those changes in the…
YulePale
  • 6,688
  • 16
  • 46
  • 95
0
votes
2 answers

How to update multiple rows in sequelize

I am trying to update multiple rows using Sequelize. But, it will give me Error . SequelizeValidationError","errors": [{"message":"id cannot be an array or an object", "type":"string violation", "path":"id", …
0
votes
2 answers

Sequelize - Creating Multiple Tables Using Id of First Table Created

I'm doing a project using Express, & Sequelize and have run into an issue: I'm trying to create an api route that, on a button click, will create a row in my 'member' & 'memberinstrument' tables. Those tables have an association in my models that:…
0
votes
1 answer

Can we generate model from using a migration file via sequalize?

Can we generate model using a migration file ? i have created migrations file . i want to genrate corresponding model file using it ? is it possible in node sequlizer ? This is my one of migration file : module.exports = { up: (queryInterface,…
0
votes
1 answer

Sequelize: Change DB password on prduction DB

I would like to change my DB password in production in Sequelize. So I would like to run a script that changes my DB password for connection, and next time I preform application to update it does not get overridden :) Here is my for sample…
Loki
  • 1,064
  • 2
  • 26
  • 55
0
votes
1 answer

Sequelizer - Unexpected token z in JSON at position 65

hope someone can help me. After running the Sequelize model generator, I succesfully generate my model and database migration. However, when I run the sequlize db:migrate command, I get this error ERROR: Error reading "src\db\config\config.json".…
user3926863
  • 325
  • 4
  • 13
0
votes
1 answer

SequelizeDatabaseError: SQLITE_ERROR: no such table: Users

I'm using Sequelize with sqlite and when i try to insert data to the table gives me the error Executing (default): INSERT INTO `Users` (`id`,`username`,`password`,`createdAt`,`updatedAt`) VALUES (NULL,$1,$2,$3,$4); { SequelizeDatabaseError:…
Gabriel_costa
  • 31
  • 1
  • 5