| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * Class M240710082541AddIsPrintToQimallAddonsStoreOrder
- */
- class M240710082541AddIsPrintToQimallAddonsStoreOrder extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- // 在qimall_addons_store_order增加一个字段
- $sql1 = <<<SQL
- ALTER TABLE `qimall_addons_store_order`
- ADD COLUMN `is_print` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已打印 0 否 1 是';
- SQL;
- $this->execute($sql1);
- // 在qimall_addons_store_menu增加一条记录
- $sql2 = <<<SQL
- INSERT INTO `qimall_addons_store_menu`
- (`title`, `app_id`, `pid`, `addons_name`, `is_addon`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`)
- SELECT '打印日志', '0', 3, '', 0, 'store/client/order/print-log', '', 2, 0, 999, NULL, '', 1, 0, 0
- FROM DUAL
- WHERE NOT EXISTS (
- SELECT 1 FROM `qimall_addons_store_menu` WHERE `url` = 'store/client/order/print-log'
- );
- SQL;
- $this->execute($sql2);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- }
- }
|