|
@@ -24,17 +24,17 @@ |
|
|
block discarded – undo |
|
24
|
24
|
} |
|
25
|
25
|
// https://segmentfault.com/q/1010000000672529/a-1020000000679702 |
|
26
|
26
|
$this->createTable($this->tableName, [ |
|
27
|
|
- 'id' => $this->bigPrimaryKey()->unsigned()->comment('Id'),//通知ID |
|
28
|
|
- 'user_id' => $this->unsignedInteger()->notNull()->comment('User Id'),//接收器 |
|
29
|
|
- 'verb' => $this->string(32)->notNull()->comment('Verb'),//活动图片 |
|
30
|
|
- 'template' => $this->string()->notNull()->comment('Template'),//通知类型 |
|
31
|
|
- 'is_read' => $this->boolean()->defaultValue(false)->comment('Read'),//是否已读 |
|
32
|
|
- 'is_pending' => $this->boolean()->defaultValue(false)->comment('Pending'),//是否已经推送 |
|
33
|
|
- 'entity' => $this->text()->notNull()->comment('Entity'),//通知实体 |
|
34
|
|
- 'publish_at' => $this->unixTimestamp()->notNull()->comment('Publish At'),//发送时间 |
|
|
27
|
+ 'id' => $this->bigPrimaryKey()->unsigned()->comment('Id'), //通知ID |
|
|
28
|
+ 'user_id' => $this->unsignedInteger()->notNull()->comment('User Id'), //接收器 |
|
|
29
|
+ 'verb' => $this->string(32)->notNull()->comment('Verb'), //活动图片 |
|
|
30
|
+ 'template' => $this->string()->notNull()->comment('Template'), //通知类型 |
|
|
31
|
+ 'is_read' => $this->boolean()->defaultValue(false)->comment('Read'), //是否已读 |
|
|
32
|
+ 'is_pending' => $this->boolean()->defaultValue(false)->comment('Pending'), //是否已经推送 |
|
|
33
|
+ 'entity' => $this->text()->notNull()->comment('Entity'), //通知实体 |
|
|
34
|
+ 'publish_at' => $this->unixTimestamp()->notNull()->comment('Publish At'), //发送时间 |
|
35
|
35
|
], $tableOptions); |
|
36
|
36
|
|
|
37
|
|
- $this->createIndex('notification_index', $this->tableName, ['user_id','is_pending']); |
|
|
37
|
+ $this->createIndex('notification_index', $this->tableName, ['user_id', 'is_pending']); |
|
38
|
38
|
|
|
39
|
39
|
$this->addForeignKey('notification_fk_1', $this->tableName, 'user_id', '{{%user}}', 'id', 'CASCADE', 'RESTRICT'); |
|
40
|
40
|
} |