app/DoctrineMigrations/Version20201127000000.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of EC-CUBE
  5. *
  6. * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  7. *
  8. * http://www.ec-cube.co.jp/
  9. *
  10. * For the full copyright and license information, please view the LICENSE
  11. * file that was distributed with this source code.
  12. */
  13. namespace DoctrineMigrations;
  14. use Doctrine\DBAL\Schema\Schema;
  15. use Doctrine\Migrations\AbstractMigration;
  16. /**
  17. * Auto-generated Migration: Please modify to your needs!
  18. */
  19. final class Version20201127000000 extends AbstractMigration
  20. {
  21. public function up(Schema $schema): void
  22. {
  23. $count = $this->connection->fetchOne("SELECT COUNT(*) FROM dtb_page WHERE url = 'entry_confirm'");
  24. if ($count > 0) {
  25. return;
  26. }
  27. $pageId = $this->connection->fetchOne('SELECT MAX(id) FROM dtb_page');
  28. $sortNo = $this->connection->fetchOne('SELECT MAX(sort_no) FROM dtb_page_layout');
  29. $pageId++;
  30. $this->addSql("INSERT INTO dtb_page (
  31. id, master_page_id, page_name, url, file_name, edit_type, create_date, update_date, meta_robots, discriminator_type
  32. ) VALUES(
  33. $pageId, 18, '会員登録(確認ページ)', 'entry_confirm', 'Entry/confirm', 3, '2020-01-12 01:15:03', '2020-01-12 01:15:03', 'noindex', 'page'
  34. )");
  35. $sortNo++;
  36. $this->addSql("INSERT INTO dtb_page_layout (page_id, layout_id, sort_no, discriminator_type) VALUES ($pageId, 2, $sortNo, 'pagelayout')");
  37. $pageId++;
  38. $this->addSql("INSERT INTO dtb_page (
  39. id, master_page_id, page_name, url, file_name, edit_type, create_date, update_date, meta_robots, discriminator_type
  40. ) VALUES(
  41. $pageId, 12, 'MYページ/退会手続き(確認ページ)', 'mypage_withdraw_confirm', 'Mypage/withdraw_confirm', 3, '2020-01-12 01:15:03', '2020-01-12 01:15:03', 'noindex', 'page'
  42. )");
  43. $sortNo++;
  44. $this->addSql("INSERT INTO dtb_page_layout (page_id, layout_id, sort_no, discriminator_type) VALUES ($pageId, 2, $sortNo, 'pagelayout')");
  45. $pageId++;
  46. $this->addSql("INSERT INTO dtb_page (
  47. id, master_page_id, page_name, url, file_name, edit_type, create_date, update_date, meta_robots, discriminator_type
  48. ) VALUES(
  49. $pageId, 16, 'お問い合わせ(確認ページ)', 'contact_confirm', 'Contact/confirm', 3, '2020-01-12 01:15:03', '2020-01-12 01:15:03', 'noindex', 'page'
  50. )");
  51. $sortNo++;
  52. $this->addSql("INSERT INTO dtb_page_layout (page_id, layout_id, sort_no, discriminator_type) VALUES ($pageId, 2, $sortNo, 'pagelayout')");
  53. if ($this->platform->getName() === 'postgresql') {
  54. $this->addSql("SELECT setval('dtb_page_id_seq', $pageId)");
  55. }
  56. }
  57. public function down(Schema $schema): void
  58. {
  59. // this down() migration is auto-generated, please modify it to your needs
  60. }
  61. }