| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace addons\Store\console\migrations;
- use addons\Store\common\models\StoreAdmin;
- use yii\db\Migration;
- /**
- * Class M240826203048CreateQimallAddonsStoretrack
- */
- class M240826203048CreateQimallAddonsStoreGoodstrack extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_addons_store_goods_tracking';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $this->execute("CREATE TABLE `qimall_addons_store_goods_tracking` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
- `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
- `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品id',
- `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
- `browse_num` int(11) NOT NULL DEFAULT '0' COMMENT '浏览次数',
- `track_date` int(11) NOT NULL DEFAULT '0' COMMENT '日期,格式ymd[20240826]',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[0禁用 1启用 -1删除]',
- `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
- PRIMARY KEY (`id`),
- KEY `mall_id` (`mall_id`) USING BTREE,
- KEY `store_id` (`store_id`) USING BTREE,
- KEY `goods_id` (`goods_id`) USING BTREE,
- KEY `user_id` (`user_id`) USING BTREE
- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='商城商品埋点表';");
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240826203048CreateQimallAddonsStoretrack cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240716083948AlterQimallAddonsStoreAdmin cannot be reverted.\n";
- return false;
- }
- */
- }
|