db->createCommand($sql)->execute(); if(!empty($res)) return ''; $sql="CREATE TABLE `{$table}` ( `id` int(10) NOT NULL AUTO_INCREMENT, `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID', `cate_id` int(10) NOT NULL DEFAULT '0' COMMENT '分类ID', `name` varchar(45) NOT NULL DEFAULT '' COMMENT '名称', `label_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '标签类型:1:自动;2:手动', `user_num` int(10) NOT NULL DEFAULT '0' COMMENT '会员数量', `condition` text NOT NULL COMMENT '达标条件', `color` varchar(255) NOT NULL DEFAULT '' COMMENT '颜色', `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]', `created_at` int(10) NOT NULL DEFAULT '0', `updated_at` int(10) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) USING BTREE, KEY `mall_id` (`mall_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员标签';"; $this->execute($sql); } catch (\Exception $e) { } } /** * {@inheritdoc} */ public function safeDown() { echo "M230329074638CreateQimallMemberLabel cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M230329074638CreateQimallMemberLabel cannot be reverted.\n"; return false; } */ }