Source code: https://github.com/sequelize/sequelize
Some usage examples under: Section "Sequelize example".
As of 2021, this library is extremelly painful to use. It does feel semi-mature, but there are just too much horrible things going on;
- the documentation is a bit messy and misses a lot of stuff. The examples are often too short, and it is hard to understand what specific options they are talking about do because they lack clear input/expected output pairs. Examples:
- the implementation has several inelegant/unintuitive annoyances/requirements of code repetition that drive you mad.The association API feels notably bad, it took a few days for Ciro Santilli to learn to do what he considers "basic" association operations, knowledge which he dumped to: https://stackoverflow.com/questions/22958683/how-to-implement-many-to-many-association-in-sequelize/67973948#67973948
- bugs ar piling. It appears that many key devs left, and current maintainers are not being able to keep up
Some glaring issues include:
- foreign keys are capitalized:
- you must give
foreignKeywhen using aliases, otherwise it fails subtely. That would be derived automatically.
- https://stackoverflow.com/questions/41502699/return-flat-object-from-sequelize-with-association can't auto-flatten to reuse the database's
offsetdon't work without
- https://stackoverflow.com/questions/34059081/how-do-i-reference-an-association-when-creating-a-row-in-sequelize-without-assum hard to not duplicate foreign keys values everywhere
- stack traces permanently broken or requiring non-obvious configs:
- does not automatically update fields on hooks: https://github.com/sequelize/sequelize/issues/8586#issuecomment-422877555
- no way to do (non-raw) queries during migrations, e.g. to update fields based on other fields in a complex way?
- cannot change columns when other columns have constraints due to the backup table?
- you have to use
attributealiased fields, why? https://stackoverflow.com/questions/32649218/how-do-i-select-a-column-using-an-alias/69890944#69890944
.idgets added to
SELECTno matter, what, breaking
GROUP BYunless you do horrible workarounds:
- Node.js object-relational mapping library | 0, 869, 2
- Node.js library | 0, 876, 6
- Node.js | 32, 3k, 28
- List of programming languages | 0, 4k, 69
- Programming language | 619, 5k, 74
- Software | 0, 21k, 426
- Computer | 138, 33k, 747
- Information technology | 0, 33k, 759
- Technology | 0, 52k, 1k
- Ciro Santilli's Homepage | 262, 238k, 4k