| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Handles adding columns to table `{{%order_detail}}`.
- */
- class M241114014502AddUnshippedNumColumnToOrderDetailTable extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = <<<SQL
- ALTER TABLE `qimall_order_detail`
- ADD COLUMN `unshipped_num` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '未发货数量';
- UPDATE `qimall_order_detail` SET `unshipped_num` = `num` WHERE `shipping_status` = 0;
- SQL;
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- return false;
- }
- }
|