| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M240627092827InsertQimallAddonsStoreMenu
- */
- class M240627092827InsertQimallAddonsStoreMenu extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $sql = <<<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', 2, '', 0, 'store/client/specs/index', '', 2, 0, 999, NULL, '', 1, 0, 0
- FROM DUAL
- WHERE NOT EXISTS (
- SELECT 1 FROM qimall_addons_store_menu WHERE url = 'store/client/specs/index'
- );
- SQL;
- $this->execute($sql);
- } catch (\Exception $e) {
- \Yii::error('增加自定义规格菜单错误了:' . $e->getMessage());
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240627092827InsertQimallAddonsStoreMenu cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240627092827InsertQimallAddonsStoreMenu cannot be reverted.\n";
- return false;
- }
- */
- }
|