-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
Milestone
Description
What are you doing?
In a migration file, I used the following snippet to create a table, and specified the "uniqueKeys" option to create a unique constraint.
sequelize.queryInterface.createTable("MyModel", {
id: { type: Sequelize.INTEGER, primaryKey: true},
col1: { type: Sequelize.INTEGER},
col2: { type: Sequelize.INTEGER}
},
{ "uniqueKeys": { "col1_col2_unique": { "fields": ["col1","col2"]}}
});What do you expect to happen?
I wanted Sequelize to create a unique constraint on columns col1 and col2.
Up to 4.33.2 this used to work. The generated SQL was:
CREATE TABLE IF NOT EXISTS "MyModel"
("id" INTEGER , "col1" INTEGER, "col2" INTEGER,
UNIQUE ("col1", "col2"), PRIMARY KEY ("id"));What is actually happening?
With 4.33.3 this is no longer working.
The "uniqueKeys" option is now ignored
Generated SQL no longer has the UNIQUE ("col1", "col2") part
CREATE TABLE IF NOT EXISTS "MyModel"
("id" INTEGER , "col1" INTEGER, "col2" INTEGER,
PRIMARY KEY ("id"));Dialect: postgres
Dialect version: 9.6
Database version: 9.6
Sequelize version: 4.33.3
Tested with latest release: 4.33.3
ezze, michaelhixson, boysGithub and coderavels
Metadata
Metadata
Assignees
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type