sequelize-cli Questions

3

Solved

I'm trying to build a simple Node/Express app with Sequelize, but when I try to create a new record in my relational database, I am getting the error Unhandled rejection SequelizeDatabaseError: SQL...
Palikar asked 9/1, 2017 at 21:3

14

I'm creating a DB model via Sequelize CLI with this command: sequelize model:create --name User --attributes "firstname:string, lastname:string" This creates the corresponding migration script: ...
Brewis asked 22/11, 2016 at 5:17

2

Solved

Any one know how to custom select query on sequelize seeder I have tried two ways, but no one work First attempt up: function(queryInterface, Sequelize) { return queryInterface.sequelize.query...
Whorton asked 24/7, 2017 at 17:16

6

Is it possible to run only the next migration file with the sequelize-cli? I have been looking through the docs and help-section of the cli, and it does not appear to be such a feature. For insta...
Yim asked 24/4, 2017 at 14:46

3

Solved

I am trying to get all records from a mysql Database with sequelize and I have tried following approaches: shops.findAndCountAll({ where: { createdAt: { [Op.gte]: moment().subtract(7, 'days').t...
Servetnick asked 22/2, 2020 at 18:40

2

Issue: In order to start in a clean environment for developing stuff for a web app I would appreciate to be able to retrieve some data from an existing DB (let say the 10 first lines of every table...
Swallowtailed asked 4/2, 2018 at 13:38

3

Solved

I have been struggling with the db:seed:all for over an hour now and slowly I am losing my mind about this. I have a simple model: 'use strict'; module.exports = function (sequelize, DataTypes) {...
Muco asked 10/5, 2016 at 14:12

3

Solved

I have installed Postgres 13 in windows 10. Configured all the right credentials in the environment file of the project. The project uses the below dependencies and it was created in ubuntu. "...

6

Solved

I have added a model and a migration file using this command node_modules/.bin/sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string Now I wanted to ad...
Dolhenty asked 18/4, 2018 at 4:4

6

Solved

I've two models: user.js 'use strict' module.exports = function(sequelize, DataTypes) { var User = sequelize.define('User', { gid: { type: DataTypes.INTEGER, allowNull: false, prim...
Zinc asked 21/9, 2016 at 16:9

2

I am new to Sequelize and my current project requires me to use it with migrations. I am familiar with migrations what they do and how. I am coming from Django background where each sub app has mo...
Cismontane asked 28/1, 2019 at 14:40

1

I am trying to use a raw sql query in sequelize and have this code. My table structure is an external_profile that has many connections. const users = await models.sequelize.query("SELECT `Extern...
Miter asked 1/5, 2020 at 16:31

2

Solved

I want to use sequelize seeders and migrations on my express api and currently all the models are written in typescript using sequelize-typescript I tried adding my first seeder file using typescri...

3

First off it's my first time with Sequelize so be patient. I'd like to use https://github.com/sequelize/cli along with https://github.com/lorenwest/node-config I want sequelize to be able to "com...
Educable asked 19/7, 2015 at 9:59

9

I'm using Node Express with Sequelize and I want to set the defaultValue for the column "date" in the database to todays date. I tried with the following migration, but it didn't work, as it set th...
Shirt asked 19/11, 2016 at 15:37

7

Solved

I'm using the sequelize ORM to fetch data from a PSQL DB. However, when I retrieve something, a whole bunch of data is given. The only data I want is inside 'dataValues'. Of course, I can use objec...
Tobytobye asked 23/9, 2017 at 14:20

2

I need to remove the existing foreign key constraint on a column and add a new constraint with same name which refers to primary key of another table. I am getting an error ERROR: Constraint type m...
Reedy asked 2/7, 2020 at 14:52

4

Solved

I manually deleted a migration file name 20171125081136-create-task.js. After deleting the migration file, I ran this command db:migrate:undo:all While running this command I'm getting an erro...
Manamanacle asked 19/11, 2018 at 10:53

2

Solved

I am setting up a test infrastructure using docker-compose. I want to use the docker-compose option --exit-code-from to return the exit code from the container that is running tests. However, I als...
Computation asked 14/10, 2018 at 16:37

4

Solved

anyone knows why i am getting this error this is my code "use strict"; const { DataTypes } = require("sequelize/types"); module.exports = { up: async (queryInterface, DataType...
Cranwell asked 5/3, 2021 at 5:32

3

I'm trying to set up the project using Node v14.3 and sequelize. I don't want to use babel-register. Instead of this I set "type": "module" in my package.json and use all ES6 - ES11 features out ...
Weeden asked 31/5, 2020 at 19:14

2

Solved

I am trying to migrate DB using db:migrate function, however I am getting the error printed: ERROR: Cannot read property 'replace' of undefined I have referred to other solutions for this erro...

4

I tried to find a way to copy/clone instances in Sequelize but without success. Is there any way to do it with a built-in function or without? What I want is to simply copy rows in the database and...
Obrian asked 7/8, 2018 at 11:18

3

Solved

I've been trying to write some seeds for my project, but I've ran into a bit of a snag. I've got a many-to-many relation with my users and roles table. So, when I'm seeding the database I need to ...
Wolcott asked 11/6, 2016 at 9:12

6

Solved

I have been searching through Sequelize documentation and forums for the correct syntax and it seems I am doing it the right way, but for some reason the password field is still being returned in t...
Rules asked 28/2, 2019 at 15:36

© 2022 - 2024 — McMap. All rights reserved.