app/DoctrineMigrations/Version20190821081036.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 Version20190821081036 extends AbstractMigration
  20. {
  21. const NAME = 'dtb_csv';
  22. public function up(Schema $schema): void
  23. {
  24. // this up() migration is auto-generated, please modify it to your needs
  25. if (!$schema->hasTable(self::NAME)) {
  26. return;
  27. }
  28. $taxRateExists = $this->connection->fetchOne("SELECT COUNT(*) FROM dtb_csv WHERE csv_type_id = 1 AND entity_name = ? AND field_name = 'TaxRule' AND reference_field_name = 'tax_rate'", ['Eccube\\\\Entity\\\\ProductClass']);
  29. if ($taxRateExists == 0) {
  30. $this->addSql("INSERT INTO dtb_csv (csv_type_id, creator_id, entity_name, field_name, reference_field_name, disp_name, sort_no, enabled, create_date, update_date, discriminator_type) VALUES (1, null , ?, 'TaxRule', 'tax_rate', '税率', 31, false, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,'csv')", ['Eccube\\\\Entity\\\\ProductClass']);
  31. }
  32. }
  33. public function down(Schema $schema): void
  34. {
  35. // this down() migration is auto-generated, please modify it to your needs
  36. }
  37. }