| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * Class M220906033139QimallAddonsStoreCouponStatistics
- */
- class M220906033139QimallAddonsStoreCouponStatistics extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_addons_store_coupon_statistics';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $this->createTable($table, [
- 'id' => $this->primaryKey(),
- 'mall_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('商城ID'),
- 'store_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('门店id'),
- 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'),
- 'received_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('已领取数量'),
- 'used_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('已使用数量'),
- 'giveing_times' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券被转赠的次数'),
- 'use_probability' => $this->float('5,2')->notNull()->defaultValue(0)->comment('优惠券使用率,等于领取数量比使用数量'),
- 'total_discount_amount' => $this->float('12,2')->notNull()->defaultValue(0)->comment('累计优惠金额'),
- 'receive_user_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('领券会员总数量'),
- 'use_user_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('用券会员总数量'),
- 'giving_user_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('转赠优惠券的会员总数量'),
- 'use_order_number' => $this->integer(11)->notNull()->defaultValue(0)->comment('使用优惠券支付的订单总数量'),
- 'total_use_coupon_payed_amount' => $this->float('12,2')->notNull()->defaultValue(0)->comment('使用优惠券后实际支付的总金额'),
- 'total_payed_amount' => $this->float('12,2')->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 "M220906033139QimallAddonsStoreCouponStatistics cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M220906033139QimallAddonsStoreCouponStatistics cannot be reverted.\n";
- return false;
- }
- */
- }
|