| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- *
- * Class M221206104258AlterOrderExpressLog
- */
- class M221206104258AlterOrderExpressLog extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $res = \Yii::$app->db->schema->getTableSchema("qimall_order_express_log",true);
- if(!$res->getColumn('table_express_status')){
- $sql = "ALTER TABLE `qimall_order_express_log`
- ADD COLUMN `table_express_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '物流状态0/未完成 1/已完成',
- ADD COLUMN `express_status` tinyint(2) NOT NULL DEFAULT '9' COMMENT '当前物流状态(物流公司状态)',
- MODIFY COLUMN `status` tinyint(5) NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
- ADD KEY `idx_table_exp_status_idx_mall_id` (`mall_id`,`table_express_status`);";
- $this->execute($sql);
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M221206104258AlterOrderExpressLog cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M221206104258AlterOrderExpressLog cannot be reverted.\n";
- return false;
- }
- */
- }
|