migrations/Version20220419103557.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220419103557 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE shop_settings (id INT AUTO_INCREMENT NOT NULL, shop_id INT DEFAULT NULL, email_notification TINYINT(1) NOT NULL, future_orders TINYINT(1) NOT NULL, display_foxeat TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_3EFD5A534D16C4DD (shop_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE shop_settings ADD CONSTRAINT FK_3EFD5A534D16C4DD FOREIGN KEY (shop_id) REFERENCES shop (id)');
  20.         $this->addSql('ALTER TABLE currency DROP FOREIGN KEY FK_6956883F523CAB89');
  21.         $this->addSql('DROP INDEX UNIQ_6956883F523CAB89 ON currency');
  22.         $this->addSql('ALTER TABLE currency ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP franchise_id, DROP value, DROP create_at, DROP edited_at');
  23.         $this->addSql('ALTER TABLE shop ADD currency_id INT DEFAULT NULL, ADD time_zone VARCHAR(50) NOT NULL, ADD siret VARCHAR(20) NOT NULL, ADD communication_mode VARCHAR(50) DEFAULT NULL, ADD enabled TINYINT(1) NOT NULL');
  24.         $this->addSql('ALTER TABLE shop ADD CONSTRAINT FK_AC6A4CA238248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
  25.         $this->addSql('CREATE INDEX IDX_AC6A4CA238248176 ON shop (currency_id)');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('DROP TABLE shop_settings');
  31.         $this->addSql('ALTER TABLE currency ADD franchise_id INT NOT NULL, ADD value DOUBLE PRECISION NOT NULL, ADD create_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD edited_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', DROP created_at, DROP updated_at');
  32.         $this->addSql('ALTER TABLE currency ADD CONSTRAINT FK_6956883F523CAB89 FOREIGN KEY (franchise_id) REFERENCES franchise (id)');
  33.         $this->addSql('CREATE UNIQUE INDEX UNIQ_6956883F523CAB89 ON currency (franchise_id)');
  34.         $this->addSql('ALTER TABLE shop DROP FOREIGN KEY FK_AC6A4CA238248176');
  35.         $this->addSql('DROP INDEX IDX_AC6A4CA238248176 ON shop');
  36.         $this->addSql('ALTER TABLE shop DROP currency_id, DROP time_zone, DROP siret, DROP communication_mode, DROP enabled');
  37.     }
  38. }