Skip to content
Advertisement

Tag: sequelize.js

Sequelize: Cannot set a new unique constraint message

I am trying to setup a validation message for unique constraint violation for the fields username and email. However, whenever an already taken username is entered, it shows the message defined for the email property, but shows the input for the username property and also says that this input is for the username property. How would I fix this? Here

Sequelize – How to search multiple columns?

I have a database of articles with several columns and would like to be able to search both title and description. Currently, I have: How can I also search the description as well? I’ve read through the sequelize documentation, even in the Complex filtering / OR / NOT queries section, but the examples only seem to explain searching in one

Sequelize Where statement with date

I am using Sequelize as my backend ORM. Now I wish to do some WHERE operations on a Date. More specifically, I want to get all data where a date is between now and 7 days ago. The problem is that the documentation does not specify which operations you can do on Datatypes.DATE Can anyone point me in the right

Remove constraints in sequelize migration

I’m adding a unique constraint in a migration via the migrations.changeColumn function. Adding the constraint works, but since you need to provide a “backwards migration“, removing it the same way does not. It doesn’t give any errors when migrating backwards, but again applying the forward migration results in Possibly unhandled SequelizeDatabaseError: relation “myAttribute_unique_idx” already exists. (The used database is postgres)

Heroku + Node: Cannot find module error

My Node app is running fine locally, but has run into an error when deploying to Heroku. The app uses Sequelize in a /models folder, which contains index.js, Company.js and Users.js. Locally, I am able to import the models using the following code in /models/index.js: This works fine, however, when I deploy to Heroku the app crashes with the following

Advertisement