| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace app\migrations;
- use common\models\backend\Menu;
- use yii\db\Migration;
- /**
- * Class M241209094147UpdateQimallMenu
- */
- class M241209094147UpdateQimallMenu extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $menu = Menu::find()->where(['title' => '日志记录', 'cate_id' => 2])->asArray()->one();
- if (!empty($menu)) {
- $sql = "update qimall_menu set pid =".$menu['id']." where title = '操作日志' and cate_id = 2;
- update qimall_menu set pid =".$menu['id']." where title = '短信日志' and cate_id = 2;";
- $this->execute($sql);
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M241209094147UpdateQimallMenu cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M241209094147UpdateQimallMenu cannot be reverted.\n";
- return false;
- }
- */
- }
|