M241121141030InsertAddonsStoreMenu.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M241120090450InsertAddonsStoreAddons
  6. */
  7. class M241121141030InsertAddonsStoreMenu extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $time = time();
  15. $sql = <<<SQL
  16. 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`) VALUES ('门店会员', '0', 0, 'StoreAssociatedUser', 1, 'store/store-associated-user/index/index', '', 2, 0, 999, NULL, '', 1, {$time}, {$time});
  17. SQL;
  18. $this->execute($sql);
  19. $id = $this->db->getLastInsertID($sql);
  20. $sql2 = <<<SQL
  21. 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`) VALUES ('门店会员', '0', {$id}, 'StoreAssociatedUser', 1, 'store/store-associated-user/index/index', '', 2, 0, 999, NULL, '', 1, {$time}, {$time});
  22. SQL;
  23. $this->execute($sql2);
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function safeDown()
  29. {
  30. echo "M241120090450InsertAddonsStoreMenu cannot be reverted.\n";
  31. return false;
  32. }
  33. /*
  34. // Use up()/down() to run migration code without a transaction.
  35. public function up()
  36. {
  37. }
  38. public function down()
  39. {
  40. echo "M241120090450InsertAddonsStoreMenu cannot be reverted.\n";
  41. return false;
  42. }
  43. */
  44. }