Sunday, 6 May 2018

Sequelize constraints or associations?

Hi, I'm currently working at a new place and they're using Sequelize with PostgreSQL. I was previously working with MongoDB so my knowledge of relational DBs is not quite there yet and honestly the Sequelize documentation kinda sucks.In the app I'm working on you can create sort of a profile once you're logged in, I need to validate that the profile name can't be the same if I create a different profile. This is my modelI've been told that I can achieve this using constraint between the name and the id also by using associations, but I'm not quite sure how the two work or what method I should choose.As a third way I found on the docs about the unique property which could help me validate that the name needs to be unique. Unique property

Submitted May 06, 2018 at 07:00PM by SeraphineX93

No comments:

Post a Comment