| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * Class M220906032539QimallAddonsStoreCouponReward
- */
- class M220906032539QimallAddonsStoreCouponReward extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_addons_store_coupon_reward';
- $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'),
- 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'),
- 'store_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('门店id'),
- 'reward_type' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('奖励类型,1:转赠奖励,2:使用奖励'),
- 'balance' => $this->float('12,2')->notNull()->defaultValue(0)->comment('奖励余额'),
- 'score' => $this->float('12,2')->notNull()->defaultValue(0)->comment('奖励积分'),
- 'red_packet' => $this->float('12,2')->notNull()->defaultValue(0)->comment('奖励红包'),
- 'reward_currency_type' => $this->string(50)->notNull()->defaultValue(0)->comment('奖励货币种类,记录货币 code'),
- 'number' => $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 "M220906032539QimallAddonsStoreCouponReward cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M220906032539QimallAddonsStoreCouponReward cannot be reverted.\n";
- return false;
- }
- */
- }
|