Support several columns for unique indices.
You can now declare unique indices like so: var User = sequelize.define('User', { username: { type: DataTypes.STRING, unique: { name: 'username_and_email', msg: 'Your username and email must be unique!' } }, email: { type: DataTypes.STRING, unique: 'username_and_email' }, aCol: { type: DataTypes.STRING, unique: true } }) Will create two unique indices one for username/email combo and the other for aCol. If a unique constraint occurs for aCol, the old behavior still occurs (emits a dialect returned error), but for username/email index the returned error would be, "Your username and email must be unique!"
Showing
with
121 additions
and
5 deletions
-
Please register or sign in to post a comment