Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
0 answers
38 views

Why is the stored procedure so fast? [closed]

Calling stored procedure using sequelize is giving back results in 120 ms. Same logic when written in sequelize is taking 20s. The table I am querying has 120 million records and does not have any ...
Ujwal Danta's user avatar
0 votes
0 answers
12 views

ReferenceError: Cannot access 'ProductCategory' before initialization in sequelize-typescript with Nestjs

I am trying to use Sequelize + Postgres with Nestjs, and I've defined few Models in different resources, and having HasMany, HasOne relationships with BelongsTo() in the ForeignKey Table, but I am ...
Dhaval Vira's user avatar
0 votes
0 answers
3 views

Sequelize doesn't fetch the assosiated model with a GET request

Sequelize doesn't fetch the assosiated model in the get request, but it works in the POST and DELETE requests with two parameters provided. I have an M-M relationship between the Worker and Owner id(...
koogel's user avatar
  • 70
0 votes
1 answer
33 views

Connection denied with MYSQL db when node app dockerized [duplicate]

I have a problem with connecting my node app container to MySQL database. When -compose up I keep getting error from container logs: server-1 | Unable to connect to database AccessDeniedError [...
Marko's user avatar
  • 1
-1 votes
1 answer
19 views

Is encoding required to properly store any Unicode character in a PostgreSQL database, using sequelize in typescript?

I have a typescript project which connects via sequelize to a PostgreSQL database. All string columns in all tables in the database are TEXT type, which as per PostgreSQL documentation, support ...
IvanFlores's user avatar
0 votes
0 answers
18 views

sequelize error when filtering nested columns using the '$nested.column$' syntax

I am trying to add anyField filter logic to my generic controller list method for my expressjs app using sequelize for my db logic and I can't figure out how to fix this: I am passing in the ...
Manu's user avatar
  • 569
0 votes
1 answer
13 views

How to setup nextjs and sequelizejs for Microsoft SQL Server with dialectOption Authentication=ActiveDirectoryPassword

I have to setup sequelizejs connection with Microsoft SQL Server. With Dialect option Authentication=ActiveDirectoryPassword I have tried the following option: host: '{redacted}.database.windows.net', ...
Prakash Barri's user avatar
2 votes
0 answers
44 views

Typescript module augmentation with third party library

I have a typescript server project using a third party plugin called ah-sequelize-plugin. It requires that I create config files that augment/add to their config files. Here is an example of one of ...
Zayum's user avatar
  • 109
0 votes
0 answers
24 views

How to prevent requests from altering database at the same time?

I have two requests from the client that can be held pending and executed simultaneously for a user. The two requests check the user's balance; if sufficient, it decrements the balance and then ...
Kay's user avatar
  • 99
-1 votes
0 answers
25 views

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From test/filename.test.ts

I am working on a Express project using Sequelize with MySql as dialect, and I am running into an issue when running my Jest test suites. I am using pre-push hook from husky to run the test cases, but ...
Abhishek Tiwari's user avatar
0 votes
1 answer
12 views

sequelize-typescript addColumn with 'after

I'm creating a column with sequelize with mysql/mariadb. Looking into the DOCs, it is possible to create this column after another column just defining an after attribute in third parameter, but when ...
William Gabriel Pereira's user avatar
0 votes
1 answer
24 views

Sequelize (with NextJS) sync() twice

I am using Sequelize with nextjs. During the DELETE operation, it performs sync() twice. Is this a problem or is it normal? I am sharing my codes below. // sequelize.ts import { Sequelize } from '...
LinesinRows's user avatar
0 votes
0 answers
33 views

How to Require User ID for Liking a Post in a React and Express Application?

I'm developing a web application using React for the frontend and Express for the backend, and I want to implement a feature where users must be authenticated (and their user ID verified) to like a ...
Bharath M's user avatar
0 votes
0 answers
17 views

Error: EagerLoadingError [SequelizeEagerLoadingError]: Client is not associated to Job

I'm trying to create database associations using Sequelize, but when I try test them I get an error saying that there are no associations. I've tried moving the order of the models and other code, but ...
PiledriverWaltz's user avatar
1 vote
1 answer
35 views

Fields with the 'declare' modifier cannot be initialized here, but only in the constructor

I don't even know where to begin or what to look for with this one. I'm upgrading an old React, Node, Express full-stack application, and one of the steps I'm taking is adding TypeScript. The project ...
Chris Simpson's user avatar
0 votes
0 answers
19 views

TypeError: values.map is not a function when trying to query in sequelize using operator (Op)

So I was trying to make a function that will sort table that I have by using multiple parameters, so that i can filter the table data, the parameter will be passed as JSON, something like this { &...
Pratama's user avatar
0 votes
1 answer
22 views

Using Sequelize bulkCreate as a bulk update

We have a node project with Sequelize and postgresql, and I need to improve the performance of some endpoints. And there are several cases in the code where an update query is made for each row (with ...
Daniel's user avatar
  • 534
0 votes
0 answers
20 views

How to perform a one-to-one migration

I have a particular case where I have a promotion and a survey attached to it. The thing is don't want the promotion to have FKs for surveys as the surveys can be optional, but I also don't want to ...
koogel's user avatar
  • 70
0 votes
0 answers
31 views

Sequelize findAndCountAll: Pagination and Search Conflicts with Subquery in hasMany Relationship

Texperts.findAndCountAll({ subQuery:false, where:{ ...(searchKey && { [Op.or]: [ { '$user.full_name$': { [Op.like]: `%${searchKey}%` } }, ...
Akshay Kumar K's user avatar
0 votes
1 answer
20 views

Sequelize column region.region_id does not exist error

What am i missing? any help is appreciated. Thanks facility migration file await queryInterface.createTable("facility", { id: { allowNull: false, autoIncrement: true, ...
JPDR's user avatar
  • 1
0 votes
0 answers
35 views

sql error, Saying theres no relations between tables but I cant figure out why

I have a database for a DnD builder webpage. We want to make an application that when the user selects a radio on the webpage it will pull the corresponding information from the database and display ...
Yunios's user avatar
  • 3
0 votes
0 answers
22 views

Sequelize syntax error at or near "ON DELETE" when using associations

I've created a simple express app with a Postgres database using Sequelize as the ORM to define my models. I have two models where there is a one-to-many relationship: A Faction can have many Craters ...
jimjamz's user avatar
  • 69
0 votes
0 answers
22 views

How to extend sequeulize model with typescript?

Sequelize V° 6.37.3 sequelize-typescript V° 2.1.6 I try to extend a sequelize base model. My layout conatins 2 models: Examination (parent) and ConcreteExamination (child). examination.ts import { ...
rammi22's user avatar
  • 405
0 votes
0 answers
19 views

How can I get my bluehost mysql server to work with react js, express / sequelize application? [duplicate]

While testing my application locally, I am able to create a database and populate it. When I try to use the app in production, it gives me a JSON error. I have created a user with password and granted ...
Kory Breiten's user avatar
0 votes
0 answers
16 views

react sequelize post adding values duplicate

I am using sequelize in combo with react to store, update and delete data in mysql. Now I have users and some roles. And a table that stores the roleId and userId if a user has a specific role. E.g.: ...
udarts's user avatar
  • 886
0 votes
0 answers
38 views

my Model.create() in sequelize and node.js does not save data on mysql database

I working on creating a database using MySQL, express.js, and Sequelize. My model is saved on the database, but when I send data it will not work as expected. Here is my code: Database.js const { ...
zahra1996a's user avatar
0 votes
1 answer
29 views

Sequelize skipping insertion of a specific column into my postgres DB

I have a nodejs application that is used to insert values into my Postgres DB. The payload i send contains values that are a mix of string , number and json. I have a script that inserts a record ...
Kevin Chethlan Santosh's user avatar
0 votes
1 answer
28 views

Sequelize - Avoid named binding parameters when using sequelize.fn

I am using Sequelize 6.21.3 to access a MariaDB 10.8 database. In that database i have a Users table that contains a password column which is encoded with the SQL function ENCODE. Now I'd like to ...
PiFanatic's user avatar
  • 243
0 votes
0 answers
29 views

Using bulkCreate as a bulk update in Sequelize?

I'm working on an express.js project that uses Sequelize as the ORM, and postgres as the database engine. In Sequelize, you can do an upsert for multiple rows like this: models.Package.bulkCreate( ...
Daniel's user avatar
  • 534
0 votes
0 answers
26 views

Sequelize Hooks is not triggering

I am facing an issue where the beforeCreate hook in my Sequelize model is not being triggered when I attempt to create a new record. I have defined hooks in my model, but it seems they are not ...
Mohammed Sabir's user avatar
0 votes
0 answers
13 views

Sequelize issue in a docker container [duplicate]

I'm trying to start two containers with docker-compose, but only one works, which is the database container. My API container in nodejs didn't start and when I ran the command docker logs <...
Lucas_0502's user avatar
0 votes
0 answers
34 views

problems with sequelize intermediate table

10 days ago I come with this problem I run out of ideas. what happens is that I have a many to many relationship between the entities of orders and equipment that are borrowed. the problem is as ...
lautaro carrizo's user avatar
0 votes
1 answer
53 views

How can I make an update route with express and sequelize?

I am trying to make an update route using NODE (Express and Sequelize). I'm having trouble trying to make the update item for my database. Here is how I'm trying to do it: app.put('/updateitem/:id'...
grgrafa's user avatar
0 votes
1 answer
16 views

Can't run a sequeliz query to fetch a row from an associated model

I've been trying to run this query to get the PropValue of balance-prop,where the userId is equal to user.id my relationships are as following: Prop to PropValue - 1-M PropValue to User - M-M through ...
koogel's user avatar
  • 70
0 votes
1 answer
34 views

Sequelize returning true is not working after updating v6 for mysql

I am using sequelize js v6 for MySQL Database. I want to get an updated result when I update the database but it only returns [ undefined, 1 ] I also read their documentation but they say returning is ...
Md Saif Uddin's user avatar
0 votes
0 answers
29 views

The ignoreDuplicates option on bulkCreate on Sequelize returns the data that was attempted to be created

I'm working on a node.js project using Sequelize as the orm, and postgres as the database engine, we're evaluating a concurrency solution for an endpont. This endpoint, among other things, first ...
Daniel's user avatar
  • 534
0 votes
1 answer
35 views

Sequelize: insert into join table

Tables: Users, Categories, Users_Categories Let's say one user already exists (user_id = 1) and one category already exists (category_id = 1). Now I want to "link" them through the ...
kururin's user avatar
  • 211
0 votes
1 answer
32 views

Adding RoleId and UserId results in: TypeError: Cannot read properties of undefined (reading 'create')

I am trying to add the roleId and userId in the User_Roles table, but the post create is shown an error: TypeError: Cannot read properties of undefined (reading 'create') This is the modules file for ...
udarts's user avatar
  • 886
1 vote
1 answer
60 views

Typescript interface instance values are individually undefined

I am a JavaScript and React noob. I am creating a project using TypeScript, React, Sequelize, and postgres for the database. I am trying to access a request.body member quantity in my post route using ...
Brandon Dester's user avatar
0 votes
1 answer
21 views

Roles not associated to Users

I am trying to use react with sequelize woth mysql. I have 3 modules, Users, Roles and User_Roles. I thought I have the association correctly setup, but when running the code it says: Roles not ...
udarts's user avatar
  • 886
0 votes
1 answer
68 views

Sequelize (mysql): Max database connections reached frequently

I'm using Sequelize (v6.35) with MySQL + Express app, and I'm running into a problem where my database occasionally hits the max connections limit (500). This is happening once or twice a day, ...
hThant's user avatar
  • 3
0 votes
0 answers
22 views

Issues sorting with Sequelize

I'm attempting to sort a code that has includes from multiple models, but it just won't work. static async get(queryParams) { const { search, customer_id, ...
Christoffer Madsen's user avatar
0 votes
0 answers
26 views

"update or delete on table \"category\" violates foreign key constraint \"product_category_id_fkey\" on table \"product\""

I'm using postgresql and sequelize in javascript. I continue to get this error when trying to delete an item from the category table. It occurred suddenly without any changes to the route or ...
user25753606's user avatar
1 vote
1 answer
44 views

Separating routes into different modules

I've been putting my all routes into one server.js file, after a while i realised there is about 1000 lines in one file and it is hard to manage it. The question is there a simple way to seperate ...
V4lis's user avatar
  • 15
0 votes
0 answers
27 views

How to delete oldest row sql using sequelize. subquery

I try to delete just oldest row in table so sql gonna be like this. DELETE FROM `session` WHERE `id` IN ( SELECT `id` FROM `session` WHERE `userId` = :id ORDER BY `createdAt` DESC LIMIT 1 ) ...
armada45's user avatar
  • 304
0 votes
0 answers
12 views

Connection refused when using Sequelize with MySQL running on Docker [duplicate]

I am building a dockerized API with MYSQL. I have already set up a network between the two services but Sequelize is returning a connection refused error. Here is my Dockerfile for the API FROM node:...
Emerson Lima's user avatar
0 votes
0 answers
27 views

Good way to save and load datas many to many "complex" association with Sequelize

I'm trying to insert and load my data in a belongsToMany - belongsToMany association. I'm having trouble with the recipe and ingredient association. Here is my database diagram: Here is my models: ...
BOSS_ladis's user avatar
0 votes
0 answers
36 views

How can I use the concat operator (||) in Sequelize for ilike comparison?

I'm working on an express.js project, using Sequelize on a postgres database, and we have the following query: SELECT * FROM Client WHERE first_name || ' ' || last_name ILIKE '%search term%' I'm ...
Daniel's user avatar
  • 534
-1 votes
2 answers
73 views

Relative path issue when executing ES module file with node

I need little help with building custome npm command to run ES module file, I am using this file to seed my database. i am using sequelize in a Node api (not using sequelize CLI or migrations) i want ...
Muhammad Zeeshan's user avatar
0 votes
0 answers
25 views

Error Implementing Lifecycle Hooks for Password Hashing with Sequelize-Typescript

I am working on a Node.js project using Sequelize-Typescript, and I'm trying to hash user passwords using lifecycle hooks (BeforeCreate and BeforeUpdate). However, I encounter an error related to how ...
Shahid Raza's user avatar

1
2 3 4 5
250