-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Show indexes query on Postgres fails to return functional indexes #3911
Copy link
Copy link
Closed
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
Description
Model:
module.exports = function(sequelize, DataTypes) {
var Model = sequelize.define('Company', {
name: {
type: DataTypes.STRING,
unique: true
}
}, {
indexes: [
{ name: 'unique_name', unique: true, fields: [sequelize.fn('lower', sequelize.col('name'))] }
]
});
return Model;
};
It works when the database is empty. But when I stop the server and then run it again. It throws this error:
Possibly unhandled SequelizeDatabaseError: relation "unique_name" already exists
at module.exports.Query.formatError (/Users/johnkevinmbasco/webapps/helpdesk/node_modules/sequelize/lib/dialects/postgres/query.js:415:16)
at null.<anonymous> (/Users/johnkevinmbasco/webapps/helpdesk/node_modules/sequelize/lib/dialects/postgres/query.js:110:21)
at emit (events.js:95:17)
at Query.handleError (/Users/johnkevinmbasco/webapps/helpdesk/node_modules/pg/lib/query.js:99:8)
at null.<anonymous> (/Users/johnkevinmbasco/webapps/helpdesk/node_modules/pg/lib/client.js:166:26)
at emit (events.js:95:17)
at Socket.<anonymous> (/Users/johnkevinmbasco/webapps/helpdesk/node_modules/pg/lib/connection.js:109:12)
at Socket.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:764:14)
at Socket.emit (events.js:92:17)
The contents of my /bin/www file is similar to this - https://github.com/sequelize/express-example/blob/master/bin/www
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type