M231025180521AddTableBackendUnreadCount.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M231025180521AddTableBackendUnreadCount
  6. */
  7. class M231025180521AddTableBackendUnreadCount extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = <<<SQL
  16. CREATE TABLE `qimall_backend_unread_count` (
  17. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  18. `mall_id` int(10) DEFAULT '0' COMMENT '商城ID',
  19. `type` int(10) DEFAULT '0' COMMENT '项目类型[1=订单,2=售后订单,3=提现,4=通知]',
  20. `unread_num` int(10) DEFAULT '0' COMMENT '未读总数',
  21. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  22. `created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间戳',
  23. `updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间戳',
  24. PRIMARY KEY (`id`) USING BTREE,
  25. KEY `mall_id` (`mall_id`) USING BTREE
  26. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='后台未读统计表';
  27. SQL;
  28. $this->execute($sql);
  29. } catch (\Exception $e) {
  30. }
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function safeDown()
  36. {
  37. echo "M231025180521AddTableBackendUnreadCount cannot be reverted.\n";
  38. return false;
  39. }
  40. }