| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230329074657QimallUserMemberLabel
- */
- class M230329074657QimallUserMemberLabel extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_user_member_label';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="CREATE TABLE `{$table}` (
- `id` bigint(10) NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
- `user_id` int(10) NOT NULL DEFAULT '0' COMMENT '会员ID',
- `cate_id1` int(11) NOT NULL DEFAULT '0' COMMENT '价值标签id',
- `cate_id2` int(11) NOT NULL DEFAULT '0' COMMENT '会员等级标签id',
- `cate_id3` int(11) NOT NULL DEFAULT '0' COMMENT '渠道等级标签id',
- `cate_id4` int(11) NOT NULL DEFAULT '0' COMMENT '复购标签id',
- `cate_id5` int(11) NOT NULL DEFAULT '0' COMMENT '推广标签id',
- `cate_id6` int(11) NOT NULL DEFAULT '0' COMMENT '领导标签id',
- `cate_id7` int(11) NOT NULL DEFAULT '0' COMMENT '活跃标签id',
- `cate_id8` int(11) NOT NULL DEFAULT '0' COMMENT '收入标签id',
- `cate_id9` int(11) NOT NULL DEFAULT '0' COMMENT '分享标签id',
- `cate_id10` int(11) NOT NULL DEFAULT '0' COMMENT '退款标签id',
- `cate_id11` int(11) NOT NULL DEFAULT '0' COMMENT '会员年龄标签id',
- `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `register_time` int(11) NOT NULL DEFAULT '0',
- `created_at` int(11) NOT NULL DEFAULT '0',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `idx_user_id` (`user_id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员标签表';";
- $this->execute($sql);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230329074657QimallUserMemberLabel cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230329074657QimallUserMemberLabel cannot be reverted.\n";
- return false;
- }
- */
- }
|