| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Handles the creation of table `{{%user_behavior_logs}}`.
- */
- class M240912032543CreateUserBehaviorLogsTable extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = <<<SQL
- CREATE TABLE `qimall_user_behavior_logs` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) unsigned NOT NULL DEFAULT '0',
- `operator_user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '操作人用户id',
- `operator_user_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '操作用户类型 1后台 2用户',
- `operator_target_user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '操作目标用户id',
- `behavior` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '1修改手机号 2修改关系 3注销 4修改密码 5修改支付密码 6手动升级 7手动降级 8系统自动升级 9系统自动降级 10删除用户',
- `desc` varchar(500) NOT NULL DEFAULT '',
- `extra_info` json DEFAULT NULL,
- `ip` int(10) unsigned NOT NULL DEFAULT '0',
- `status` tinyint(3) unsigned NOT NULL DEFAULT '1',
- `operation_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '实际操作时间',
- `created_at` int(10) unsigned NOT NULL DEFAULT '0',
- `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `operator_search_index` (`mall_id`,`operator_user_type`,`operator_user_id`,`behavior`),
- KEY `operator_target_search_index` (`mall_id`,`operator_target_user_id`,`behavior`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户行为日志表';
- SQL;
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- return false;
- }
- }
|