Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
17 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
19 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
32 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
24 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
  • 194
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
21 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
34 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
  • 546
-3 votes
0 answers
26 views

Does sequelize sanitize enough inputs? [closed]

I was wondering since I use Sequelize for all my queries. Should I even bother sanitizing inputs since Sequelize handles that? If yes, In what specific I do need to sanitize the inputs? And since I'm ...
Marko's user avatar
  • 1
-1 votes
1 answer
42 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
0 votes
0 answers
11 views

SequelizeConnectionAcquireTimeoutError: Best Practices for Using Sequelize ORM in Node.js Application

I’m using Sequelize ORM in my Node.js application, and I’m encountering an issue where I sometimes get a SequelizeConnectionAcquireTimeoutError. I’d like to get feedback on whether my approach is ...
Parishilan Rayamajhi's user avatar
0 votes
0 answers
34 views

Socket.io events in React.js and Node.js not being triggered

I'm building a chat application in React js and Node js. The events that I have written in React.js and Node.js do not seem to be triggered. I can login and see data in both the browser and the ...
Software Engineer's user avatar
0 votes
1 answer
43 views

Database migration tool for sequelize

I have some experience with database migration in Python, I used Alembic for managing migrations. On the node.js side we have sequelize which I found it's a nice ORM (good features, etc...), however ...
Pall Arpad's user avatar
  • 1,836
0 votes
0 answers
18 views

Sequelize slugify is not updating slug when source field is changed

I'm building web app with node js + express + sequelize backend. I created rest-api with 3 collections: goals, cashflows, accounts. For each collection there are CRUD operations available. When I send ...
Kamil's user avatar
  • 1
0 votes
0 answers
36 views

Sequalize to write raw sql join query

I have this query in sql, const query = ` SELECT prdtl.pono, prdtl.desgcode, d.descr, g.grn_dt, IFNULL(g.grnQty, 0) AS grnQty, IFNULL(gd.gdnQty, 0) AS gdnQty ...
Bappa Banerjee's user avatar
0 votes
1 answer
37 views

Sequelize doesn't works well with tests

I have some tests and, if I run only that test individually, it works normally, but if I run all the tests, it keeps printing No description found for "Users" table. Check the table name and ...
Kobra's user avatar
  • 1,293
0 votes
0 answers
19 views

Most efficient way to do a "bulk update" in Sequelize

We have an aws serverless node project, and we're using Sequelize to access our Postgres database. There's an endpoint that updates several rows, each with it's own data (right now is limited to 50 ...
Daniel's user avatar
  • 546
0 votes
0 answers
34 views

sequelize-auto conf overwritten

I'm trying to use sequelize-auto to create models for my postgres db. I'm following the docs and have this config.js: const path = require('path'); const output = path.join(__dirname, "./models2&...
eru's user avatar
  • 23
0 votes
0 answers
20 views

How to filter entity based on non-assosiated entity in sequelize

I can't filter Kase based on non-assosiated KaseColorLocation inStock property. Kase entity belongs to many Color through KaseColor Color entity belongs to many Kase through KaseColor ...
Doston Yuldashev's user avatar
0 votes
0 answers
34 views

Initializing models using initModels function from autogenerated models using sequelize-auto

It's the first time I use sequelize-auto with Typescript and I facing a bit of a problem. I am using sequelize-auto with the following flags -l ts -o my/folder/path/ --dialect postgres --cm c (with ...
leo_lo's user avatar
  • 26
-1 votes
0 answers
24 views

Retrieving Hierarchical Parent-Child Relationships in Sequelize

I want to retrieve a list of all parent companies for a particular company in Sequelize. Let me give you a scenario to help illustrate what I need: Company1 is a parent of Company2 Company1 is a ...
Arnab Mukherjee's user avatar
-2 votes
0 answers
25 views

Sequelize + Node.js + MySQL API not working after building with Webpack

I’m developing an API using Node.js, Sequelize, and MySQL. The application works fine during development, but when I build the application using Webpack, the API fails to work as expected. I’m not ...
Tharindu Lakshan's user avatar
1 vote
0 answers
15 views

How can i implement sequlize inner join

I'm trying to implement an inner join to join my post and categories table, I have tried to console log the result for the listOfCategories and it just shows an empty array. The purpose of the ...
asdsd's user avatar
  • 159
0 votes
0 answers
15 views

Issue Using sequelize.col with findAndCountAll and include in Sequelize with Join Table

Description: I'm encountering an issue in a Sequelize project when trying to use sequelize.col() to select fields from associated models. The setup involves two main models, Student and User, where ...
cesaralvarod's user avatar
0 votes
1 answer
28 views

Sequelize-typescript query runs infinite when using $get with eager loading

I have tried using eager loading in combination with the $get method on a sequelize object: await user?.$get("following", { order: [["name", "ASC"]], limit: ...
JaRoMaster's user avatar
0 votes
1 answer
94 views

Best alternatives for a fast search on a big table on a Postgres database?

We have an Express API that connects to a Postgres database using Sequelize. One of our endpoints returns a list of sales, which accepts different query parameters like page, column order, filters, ...
Daniel's user avatar
  • 546
0 votes
0 answers
23 views

Optimizing Sequelize Synchronization Time with PostgreSQL in NestJS

I'm working on a project using NestJS and Sequelize with a PostgreSQL database. My setup includes around 85 tables, and I've noticed that setting synchronize: true in Sequelize takes about 45 minutes ...
Elahe Nikseresht's user avatar
0 votes
1 answer
46 views

how to properly reserve/lock a seat in a booking application

I am building a booking system for clients who want users to book rooms, food, travel, and events. Since there are a limited number of rooms and seats in any event, how do I handle the logic of ...
vandit vasa's user avatar
0 votes
1 answer
19 views

Reference main column from subquery Sequelize

Customers is the table name, but i am getting Unknown column 'customers.id' in 'where clause' I have tried every possible solution, even directly from the documentation. const customers = await this....
Dipo Deen's user avatar
0 votes
1 answer
46 views

Electronjs + Sequelize + SQLITE3 + VITE

I can't load extra file in main process. I'm trying to use sequlieze and sqlite3 with electronjs but this error blocking me. How can i fix this? Thank you. Error: Cannot find module './database/models/...
Adrian Caragea's user avatar
1 vote
0 answers
14 views

Concurrent Requests Creating Duplications for Users

I am facing an issue with concurrent requests resulting in duplicate entries. Our system checks whether a user exists and creates a new one if not, using middleware. However, when multiple concurrent ...
Muhammad Bilal's user avatar
0 votes
1 answer
116 views

Azure Managed Identity Authentication Fails in Production for Next.js App with Sequelize and Tedious

I'm deploying a Next.js application to Azure App Service and using Sequelize as my ORM. For authentication, I'm utilizing Azure Managed Identity with the Tedious library to connect to an SQL Server. ...
Jagdish Padeliya's user avatar
0 votes
0 answers
23 views

Sequelize Eager Loading Causing Connection / Pool Issues

I recently refactored code for getting posts from a Postgres database from this: const getPostByPk = async (token, post_id) => { const requestor_id = await verifyToken(token) const post = ...
Tanuj KS's user avatar
  • 165
0 votes
0 answers
34 views

nodejs sequelize node beforeConnect hook not working

I am trying to retrieve creds and configure in this 2 ways but its not working. Now getting any logs from this when I run the lambda! import * as seq from 'sequelize'; import { retriveCredentials } ...
Akshay Bhanderi's user avatar
0 votes
0 answers
24 views

why does findOne method on sequelize just compare on the Id column of table

so this code that is a route I have created using sequelize library on mysql database const { user_name } = req.params; const user = await User.findOne({ where: { username: user_name } }); it has to ...
Sadegh Madhi's user avatar
0 votes
0 answers
24 views

Sequelize: Unable to Get Associated Resources in Category Model

I'm working on a project using Sequelize and I have two models, Category and Resource. I defined the relationship between them as Category having many Resources and Resource belonging to Category. ...
Jagdish Padeliya's user avatar
0 votes
1 answer
35 views

ORM Sequelize model.upsert() is not a function

Version sequelize 6.37.3 I try to upsert() myModel but the mehtod returns: TypeError: model.upsert is not a function my_model.controller.ts ... class MyModelController { private model: any; ....
rammi22's user avatar
  • 405
0 votes
1 answer
14 views

TypeError: Job.create is not a function

I'm using sequelize in my project, and importing the Job(variable connected to the database) from the models folder, but when I use Job.create it returns this error when inserting data into postman: ...
Antônio Souza's user avatar
0 votes
1 answer
26 views

While trying to login into my Next.js app, getting 500 error, Import trace for requested module

I have setup my Next.js web application in my local system. While trying to login into app, I am getting following error, ie login request POST http://localhost:3000/api/login 500 (Internal Server ...
soccerway's user avatar
  • 11.5k
1 vote
1 answer
27 views

How can we add String Validation Like Enum In Nodejs and Sequelize

type: { type: DataTypes.STRING, defaultValue: "Normal" } In this type I want to add validation only the type can be "Normal" or "Installment" I don't ...
Hiren Kalariya's user avatar
0 votes
0 answers
28 views

Defining hasMany self-associations in sequelize v7

export default class Folder extends Model<InferAttributes<Folder>, InferCreationAttributes<Folder>> { @Attribute(DataTypes.INTEGER) @PrimaryKey @AutoIncrement declare id: ...
Narayan Waraich's user avatar
0 votes
0 answers
31 views

Sequelize - PostgreSQL timezone won't change

I can't use anything else but UTC when reading a Date datatype. Here's my object to be added to PostgreSQL db: { "word": "test", "wordLanguage": "eng", ...
Tolgay Toklar's user avatar
0 votes
1 answer
23 views

Sequelize DatabaseError "missing FROM-clause entry for table" filtering nested include / join

I have double nested include / join of tables. I need to filter first include using second includes column In the end I want to filter users that have no linked items in associated table. I'm using ...
Nickers's user avatar
  • 43
0 votes
0 answers
36 views

How to fix ER_NO_SUCH_TABLE error when using Model.create with sequelize in MySQL when terminal shows models have been made?

I have read that MySQL does not support autoincrementing values with bulk inserts (bulkCreate() function) so I used a looping create() function instead to test whether it will work that way. NOTE: if ...
RendezYT's user avatar
0 votes
1 answer
40 views

How to get Sequelize to recognize by primary key with MySQL database data set and fix bulkCreate() issue?

So I have a database where I am trying to establish a one-to-many relationship between Supplier and TreeSeed, whereby one Supplier can sell many TreeSeed. I have looked at the sequelize documentation ...
RendezYT's user avatar
0 votes
1 answer
59 views

How to get Sequelize to recognize my custom foreign key and primary keys in a one-to-many relationship in MySQL during bulkcreate insert?

I am building a plant/arboretum style application in JavaScript. I am trying to create a one-to-many relationship between Supplier model and TreeSeed model. Meaning that one supplier can sell multiple ...
RendezYT's user avatar
2 votes
2 answers
130 views

Why am I getting error: no pg_hba.conf while connecting nodejs application to aws rds Postgres?

I have created an instance of RDS Postgres on database. I am trying to use it in my nodejs application as remote database. The things require to make connection to db include endpoint, username, ...
Tauseef Razaq's user avatar
0 votes
0 answers
51 views

How to query two Sequelize models through a junction table? Sequelize throwing error on 'through: model'

I am writing a webapp for practice. I have several sequelize models, and querying the db through them so far has been no issue. However, when I tried to use a junction table to return what would be a ...
PandaBearTellEm's user avatar
0 votes
1 answer
33 views

Sequelize code first with mysql cannot generate database

I am facing an issue related to sequelize when generating the database by commandline npx sequelize-cli db:migrate The firsting I installing my sql and using MySQL Workbench to connect it -> ...
hhpr98's user avatar
  • 65
0 votes
0 answers
54 views

Setting up SQL Server 2012 (v11.0.0) in Node.JS v20.15.0 as Backend API or Data Access Layer Structure

I need to set add-ons on my Flutter project, this is a Backend API using Node.JS which will serve as a middleman API for my Flutter project to retrieve and manage data from database in any platform (e....
Alberth A. Laguartilla's user avatar

1
2 3 4 5
250