M240619100157InsertRbacAuthItem.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240619100157InsertRbacAuthItem
  6. */
  7. class M240619100157InsertRbacAuthItem extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = <<<SQL
  16. INSERT INTO `qimall_rbac_auth_item` (`name`, `title`, `app_id`, `addons_name`, `pid`, `level`, `is_addon`, `sort`, `tree`, `status`, `created_at`, `updated_at`, `cate_id`)
  17. VALUES ('mall/order/print-log', '打印日志', 'backend', '', '2819','2','0','999','tr_0 tr_2819','1','1638268906','1638782078','2');
  18. SQL;
  19. $this->execute($sql);
  20. } catch (\Exception $e) {
  21. echo "Error inserting record into table qimall_menu: " . $e->getMessage() . "\n";
  22. }
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function safeDown()
  28. {
  29. echo "M240619100157InsertRbacAuthItem cannot be reverted.\n";
  30. return false;
  31. }
  32. /*
  33. // Use up()/down() to run migration code without a transaction.
  34. public function up()
  35. {
  36. }
  37. public function down()
  38. {
  39. echo "M240619100157InsertRbacAuthItem cannot be reverted.\n";
  40. return false;
  41. }
  42. */
  43. }