12,430 questions
1
vote
0
answers
45
views
Sequelize limit insert or create in 100 rows
I am use Sequelize with Postgree in a Serveless project. I just try to get an array of +600 objects from API and I need to send to DB. I use a map() for that array and I use sequelize upsert() or ...
0
votes
0
answers
36
views
Many to many relationship Sequelize v7
I´m trying to establish a follow list to from user to user:
class Follower extends Model<InferAttributes<Follower>, InferCreationAttributes<Follower>> {
@Attribute(DataTypes.UUID)
...
0
votes
2
answers
42
views
sequelize relationships Cannot read properties of undefined (reading 'hasMany')
I'm trying to integrate sequelize with the db conection to postgres and i am getting an error where relationships are built.
i don't know if i'm missing something at this point
index.js
'use strict';
...
0
votes
0
answers
38
views
Sequelize bulkCreate fails with duplicate entry error despite non-duplicate data and updated unique constraints
i am trying to migrate the dataset in mysql database being the role_id and module_id same mysql is refusing to store saying
sqlMessage: "Duplicate entry '3-1' for key 'role_module_bridge....
0
votes
0
answers
34
views
Sequelize bulkCreate updateOnDuplicate: Cannot read properties of undefined (reading 'map')
I want to update multiple records ( more than 100 ) and for this I am trying to use bulkCreate method of sequelize with following parameters:
const updatedUsers = await User.bulkCreate(allUserInfo, {
...
1
vote
0
answers
26
views
Cannot generate model using sequelize-cli enum with defaultValue
My sequelize-cli is
npx sequelize-cli model:generate --name Profile --attributes username:string,imageUrl:string,fullname:string,dateOfBirth:date,UserId:UUID,role:enum:'{staff,admin}':defaultValue:...
0
votes
0
answers
46
views
How to infer model type from plain schema in Sequelize?
In Sequelize, I've the following schema:
const User = sequelize.define('User', {
name: DataTypes.STRING,
email: DataTypes.STRING,
})
But in TS, User ends up being typed as ModelCtor<Model<...
0
votes
0
answers
22
views
How do I get the typed raw attributes of a Sequelize model that's a property of another model that is optional?
I have a Sequelize model that has a property that is also a model. In this case, Category has a property ParentCategory that is an optional model of Category. When I get the "non model" ...
0
votes
0
answers
13
views
exclude sequelize lib when using vite to build application
I have a frontend web project A with dependencies B, the dependencies B using sequelize that only work in node with server side. So I tried to exlclude sequelize https://sequelize.org/ in project A ...
1
vote
1
answer
137
views
How to properly include SQLite3 with an Electron, Electron Forge, Sequelizer set-up in production?
I've been trying to set-up a working Electron application using Electron Forge with Sqlite3 and Sequelize. This has worked great up until where I need to actually build and package, and distribute the ...
-3
votes
1
answer
87
views
Getting False-positive SQL Injection warnings on parameterized Sequelize queries in Snyk Code
I maintain a Node.js (v14.x) + Express + Sequelize (v6.x) application and use Snyk Code to catch security issues in our CI pipeline. We rely heavily on Sequelize’s parameter binding (:param) to ...
1
vote
1
answer
77
views
How to add order clause in sequelize-cursor-pagination
I'm using the sequelize-cursor-pagination package to implement pagination in my Node-Postgres application. I need to order my results based on a field from an included (associated) model, but the ...
-1
votes
1
answer
66
views
How to exclude unnecessary database dialects while bundling with esbuild/rollup in Vite with Sequelize?
I have been scratching my head for a while now trying to figure out how to exclude unnecessary database dialect adapters. For context, I am building an app with Vite. Its using ElectronJs and ...
0
votes
1
answer
39
views
Sequelize Associations Miss Some Data
I'm making a query to Articles table to get the article data with publisher, tags, images and categories. The relation between publisher and article is M:1, between tags and articles N:M, between ...
0
votes
1
answer
36
views
Dynamic includes in node API with Sequelize
I am creating a node API connecting to a mySql db using Sequelize. I want users of the API to be able to specify which models to include in the results of a query. For example I have a model like this:...