| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M240507155532AddSystemMenu
- */
- class M240507155532AddSystemMenu extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $time = time();
- $sql = <<<SQL
- INSERT INTO `qimall_menu` (`title`, `app_id`, `cate_id`, `addons_name`, `is_addon`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES ('系统管理', 'backend', 1, '', 0, 0, 'admin/expire-notice/index', 'el-icon-s-operation', 1, 0, 999, '[]', 'tr_0', 1, {$time}, {$time});
- SQL;
- $this->execute($sql);
- $id = $this->db->getLastInsertID($sql);
- $tree = 'tr_0 tr_' . $id;
- $sql2 = <<<SQL
- INSERT INTO `qimall_menu` (`title`, `app_id`, `cate_id`, `addons_name`, `is_addon`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `tree`, `status`, `created_at`, `updated_at`) VALUES ('过期提醒', 'backend', 1, '', 0, {$id}, 'admin/expire-notice/index', '', 1, 0, 999, '{$tree}', 1, {$time}, {$time});
- SQL;
- $this->execute($sql2);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240507155532AddSystemMenu cannot be reverted.\n";
- return false;
- }
- }
|