m220227_143428_common_notify_pull_time.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use yii\db\Migration;
  3. class m220227_143428_common_notify_pull_time extends Migration
  4. {
  5. public function up()
  6. {
  7. /* 取消外键约束 */
  8. $this->execute('SET foreign_key_checks = 0');
  9. /* 创建表 */
  10. $this->createTable('{{%common_notify_pull_time}}', [
  11. 'id' => "int(11) NOT NULL AUTO_INCREMENT",
  12. 'member_id' => "int(10) NOT NULL COMMENT '管理员id'",
  13. 'merchant_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '商户id'",
  14. 'store_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '店铺ID'",
  15. 'type' => "tinyint(4) NULL DEFAULT '0' COMMENT '消息类型[1:公告;2:提醒;3:信息(私信)'",
  16. 'alert_type' => "varchar(20) NULL DEFAULT '0' COMMENT '提醒消息类型[sys:系统;wechat:微信]'",
  17. 'last_time' => "int(10) NULL COMMENT '最后拉取时间'",
  18. 'last_id' => "int(10) NULL COMMENT '最后拉取ID'",
  19. 'PRIMARY KEY (`id`)'
  20. ], "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公用_消息拉取表'");
  21. /* 索引设置 */
  22. /* 表数据 */
  23. /* 设置外键约束 */
  24. $this->execute('SET foreign_key_checks = 1;');
  25. }
  26. public function down()
  27. {
  28. $this->execute('SET foreign_key_checks = 0');
  29. /* 删除表 */
  30. $this->dropTable('{{%common_notify_pull_time}}');
  31. $this->execute('SET foreign_key_checks = 1;');
  32. }
  33. }
粤ICP备19079148号