M230708011241InsertStoreMenu.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230708011241InsertStoreMenu
  6. */
  7. class M230708011241InsertStoreMenu extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql="DELETE FROM qimall_addons_store_menu where url = 'store/client/setting/merchant';";
  16. $this->execute($sql);
  17. // 插入表数据
  18. $sql = "
  19. INSERT INTO qimall_addons_store_menu
  20. SET `title` = '商户号设置',
  21. `app_id` = 0,
  22. `pid` = 8,
  23. `url` = 'store/client/merchant/setting',
  24. `level` = 2,
  25. `sort` = 999,
  26. `created_at` = 1679384514,
  27. `updated_at` = 1679384514,
  28. `id` = 39
  29. ";
  30. $this->execute($sql);
  31. } catch (\Exception $e) {
  32. }
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function safeDown()
  38. {
  39. echo "M230708011241InsertStoreMenu cannot be reverted.\n";
  40. return false;
  41. }
  42. /*
  43. // Use up()/down() to run migration code without a transaction.
  44. public function up()
  45. {
  46. }
  47. public function down()
  48. {
  49. echo "M230708011241InsertStoreMenu cannot be reverted.\n";
  50. return false;
  51. }
  52. */
  53. }