db->createCommand($sql)->execute(); if(!empty($res)) return ''; $this->createTable($table, [ 'id' => $this->primaryKey(), 'mall_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('商城ID'), 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'), 'good_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('商品id'), 'booking_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('该商品使用该优惠券下单的总数量'), 'payed_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('使用该优惠券已支付的该商品数量'), 'booking_user_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('该商品使用该优惠券下单的总人数'), 'buyed_user_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('使用该优惠券已购买该商品人数'), 'status' => $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('状态[-1:删除;0:禁用;1启用]'), 'created_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('添加时间'), 'updated_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('修改时间'), ]); $this->addCommentOnTable($table,'使用优惠券购买的商品的相关数据统计'); } /** * {@inheritdoc} */ public function safeDown() { echo "M220906031357QimallAddonsStoreCouponGoodStatistics cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M220906031357QimallAddonsStoreCouponGoodStatistics cannot be reverted.\n"; return false; } */ }