Using NodeJS and Sequelize 2.0, I'm writing a migration to create a new table. In addition to the primary key, I want to mark a second column to be enforced as unique. I can't find anything about this in the documentation.
migration.createTable('data', { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, key: { // needs to be unique type: DataTypes.UUID, allowNull: false } }) .then(function () { done(); });
The following works:
key: { // needs to be unique type: DataTypes.UUID, allowNull: false, unique: true }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With