removeConstraint always removes first constraint in sqlite #10380
Labels
dialect: sqlite
For issues and PRs. Things that involve SQLite (and do not involve all dialects).
type: bug
What are you doing?
What do you expect to happen?
To go from this:
to this:
What is actually happening?
Table ends up like this:
Dialect: sqlite
Dialect version: sqlite3 - 4.0.4
Database version: SQLite 3.x database
Sequelize version: 4.42.0
Tested with latest release: Yes 4.42.0
Additional notes
Here in the code, showConstraints() returns the full sql of the table including all the constraints, even if the constraint name is passed.
They are then correctly parsed and returned as an array (all of them).
But the code here seems to assume that the constraints are filtered by constraint name and constraints[0] contains the first constraint matching the constraint name, when in fact all of them are returned in the order they appear in the CREATE TABLE sql.
The text was updated successfully, but these errors were encountered: