Category "sequelize.js"

Prevent multiple fast clicks from triggering API

For my project a instagram-clone, I have a like and dislike button. If there are no likes or dislikes from the current logged in user, both will show black. If

How to select distinct on "name" using Sequelize?

I need to translate the postgresql query below select distinct on (name) * from users To seqelize query / condition . Currently I am just selecting all users f

Problem in serverless function (serverless framework) when using sequelize orm to make requests to the database

I’m trying to set up a simple serverless environment using serverless framework, there is only one lambda function that makes a call to the database using

Sequelize query returning the wrong number of rows when models are included (findAndCountAll)

The following code should return 12 rows (req.query.limit = 12). This works fine if I don't include any associated rows, but when I include the related models i

What's the ideal way to add set data to a database in Nest.JS when starting the app for the first time?

I have a database with quite a few tables, and some of those tables need to have default information in them - stuff like categories, permissions, roles, tags,

Sequelize scope on create

I am quite new to sequelize and trying to use it with sequelize-typescript. I have a user model like this: @Scopes(() => ({ authenticated: { attr

Sequelize: find count of 3 level associated model entries

I have a products database structure as follows: Categories > Sub categories > Child categories > Products the respective table names in mySql database

Sequelize how to return result as a 2D array instead of array of objects?

I am using Sequelize query() method as follows: const sequelize = new Sequelize(...); ... // IMPORTANT: No changed allowed on this query const queryFromUser = "

How to integrate Sequelize ORM with Oracle DB

I’m trying to connect to an oracle database using Sequelieze ORM. I know that Sequelieze doesn't support Oracle but I'm asking if there is any way to do t

sequelize migration throws ERROR: function uuid_generate_v4() does not exist

I enabled uuid extension with CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; Then ran same query generated by sequelize for migration and it worked, create table i

INNER JOIN on array of id's which returns array of objects by using sequelize raw query in node.js

I have data in the below format { "userId": 1 "stateId": 199, "productId": [ 1, 2 ] } I want to get this type of response

How to create relationship between two tables using feathersjs, sequelize and postgresql

I have two models users.model.js and swing-trades.model.js when I am creating a relationship between these two models and running feathersjs using npm run dev`,

Retrieve two foreign keys nodejs sequelize

I have a route and I want it to send two primary keys as foreign keys to my orderline table. I have three tables a customer, address and orderline table. an ord

Sequelize transaction with optimistic locking is locking the whole db

I have an API coded with Node.js and I use a SQLite database with Sequelize. When I make updates, I use a transaction to rollback if something failed during the

Sequelize filter the included tables by where

I am trying to findAll records included nested tables, but did not understand how could I filter included tables by where clause. Here are the words: const play

Sequelize UUID with mySQL: Unable to set default value

I've been trying for awhile to set id (primary key) for my Users table as UUID. However, I keep getting this error: Field 'id' doesn't have a default value, whe

deleting all entries with FK when PK entry is deleted sequelize

I have a post and a notification model. notification has a onPostId FK. When a post is deleted how can I let sequelize know to delete all the notifications that

Accidentially deleted rows from pg_enum

Was looking to drop an enum and did it incorrectly by deleting the rows from the pg_enum table. I should have removed it with this: DROP TYPE IF EXISTS "enum_Or

Sequelize exclude returns different value

So when I query without attribute: exclude... it returns me the correct user, but when I insert that in the query it returns a completly different user. Here is

How to run migrations with dynamic schemas?

I'm using Sequelize (Postgres) and I'm trying to dynamically create schemas and run migrations in them. In other words, I'm not using sequelize.define, because