-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Restarting sequelize app with indexes causes ER_DUP_KEYNAME #2162
Copy link
Copy link
Closed
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
Description
Example:
var Sequelize = require('sequelize');
var sequelize = new Sequelize('sequelize-test', 'root', '');
var Model = sequelize.define('Model', {
key: Sequelize.STRING
}, {
indexes: [
{
name: 'key-index',
fields: ['key']
}
]
});
sequelize.sync();First start everything works fine. Starting the app again generates following error:
Executing (undefined): CREATE TABLE IF NOT EXISTS `Models` (`id` INTEGER NOT NULL auto_increment , `key` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (undefined): CREATE INDEX `key-index` ON `Models` (`key`)
Possibly unhandled Error: ER_DUP_KEYNAME: Duplicate key name 'key-index'
Tested with current master version.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type