migrations/Version20230807072456.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 Version20230807072456 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 regles (id INT AUTO_INCREMENT NOT NULL, id_client_id INT NOT NULL, created_by_id INT NOT NULL, quantity_mails INT NOT NULL, regle JSON NOT NULL, date_created DATE NOT NULL, INDEX IDX_9040B7CE99DED506 (id_client_id), INDEX IDX_9040B7CEB03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE regles_verification (id INT AUTO_INCREMENT NOT NULL, rule_id_id INT NOT NULL, date DATE NOT NULL, email JSON DEFAULT NULL, statut VARCHAR(25) NOT NULL, INDEX IDX_F03E3EC3B176BE97 (rule_id_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE regles ADD CONSTRAINT FK_9040B7CE99DED506 FOREIGN KEY (id_client_id) REFERENCES clients (id)');
  21.         $this->addSql('ALTER TABLE regles ADD CONSTRAINT FK_9040B7CEB03A8386 FOREIGN KEY (created_by_id) REFERENCES contacts (id)');
  22.         $this->addSql('ALTER TABLE regles_verification ADD CONSTRAINT FK_F03E3EC3B176BE97 FOREIGN KEY (rule_id_id) REFERENCES regles (id)');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE regles DROP FOREIGN KEY FK_9040B7CE99DED506');
  28.         $this->addSql('ALTER TABLE regles DROP FOREIGN KEY FK_9040B7CEB03A8386');
  29.         $this->addSql('ALTER TABLE regles_verification DROP FOREIGN KEY FK_F03E3EC3B176BE97');
  30.         $this->addSql('DROP TABLE regles');
  31.         $this->addSql('DROP TABLE regles_verification');
  32.     }
  33. }