不要怂,就是干,撸起袖子干!

Commit 8a4f5280 by ivesdebruycker Committed by Mick Hansen

Primary key should be same as unique key (doc change) (#6251)

* Primary key should be same as unique key

If not, a primary key for taggable_id is created, so no more than one tag per taggable could be created.

* Define id

If not, a primary key for taggable_id is created, so no more than one tag per taggable could be created.
1 parent 0cd3031e
Showing with 5 additions and 0 deletions
......@@ -342,6 +342,11 @@ For brevity, the example only shows a Post model, but in reality Tag would be re
```js
ItemTag = sequelize.define('item_tag', {
id : {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
tag_id: {
type: DataTypes.INTEGER,
unique: 'item_tag_taggable'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!