migrations/Version20230804104239.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 Version20230804104239 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 recents_activity (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, member_entity_id INT DEFAULT NULL, event_entity_id INT DEFAULT NULL, boisson_entity_id INT DEFAULT NULL, category_boissons_entity_id INT DEFAULT NULL, notification_entity_id INT DEFAULT NULL, created_at DATETIME NOT NULL, name_of_activity VARCHAR(255) NOT NULL, description_of_activity VARCHAR(255) NOT NULL, INDEX IDX_D0FF1D90B03A8386 (created_by_id), INDEX IDX_D0FF1D90C10DAB98 (member_entity_id), INDEX IDX_D0FF1D907B04360 (event_entity_id), INDEX IDX_D0FF1D90BB6F2E0 (boisson_entity_id), INDEX IDX_D0FF1D9018374EB4 (category_boissons_entity_id), INDEX IDX_D0FF1D9027CC3A02 (notification_entity_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE recents_activity ADD CONSTRAINT FK_D0FF1D90B03A8386 FOREIGN KEY (created_by_id) REFERENCES `user` (id)');
  20.         $this->addSql('ALTER TABLE recents_activity ADD CONSTRAINT FK_D0FF1D90C10DAB98 FOREIGN KEY (member_entity_id) REFERENCES `user` (id)');
  21.         $this->addSql('ALTER TABLE recents_activity ADD CONSTRAINT FK_D0FF1D907B04360 FOREIGN KEY (event_entity_id) REFERENCES events (id) ON DELETE CASCADE');
  22.         $this->addSql('ALTER TABLE recents_activity ADD CONSTRAINT FK_D0FF1D90BB6F2E0 FOREIGN KEY (boisson_entity_id) REFERENCES boissons (id) ON DELETE CASCADE');
  23.         $this->addSql('ALTER TABLE recents_activity ADD CONSTRAINT FK_D0FF1D9018374EB4 FOREIGN KEY (category_boissons_entity_id) REFERENCES category_boissons (id) ON DELETE CASCADE');
  24.         $this->addSql('ALTER TABLE recents_activity ADD CONSTRAINT FK_D0FF1D9027CC3A02 FOREIGN KEY (notification_entity_id) REFERENCES notifications_send (id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE recents_activity DROP FOREIGN KEY FK_D0FF1D90B03A8386');
  30.         $this->addSql('ALTER TABLE recents_activity DROP FOREIGN KEY FK_D0FF1D90C10DAB98');
  31.         $this->addSql('ALTER TABLE recents_activity DROP FOREIGN KEY FK_D0FF1D907B04360');
  32.         $this->addSql('ALTER TABLE recents_activity DROP FOREIGN KEY FK_D0FF1D90BB6F2E0');
  33.         $this->addSql('ALTER TABLE recents_activity DROP FOREIGN KEY FK_D0FF1D9018374EB4');
  34.         $this->addSql('ALTER TABLE recents_activity DROP FOREIGN KEY FK_D0FF1D9027CC3A02');
  35.         $this->addSql('DROP TABLE recents_activity');
  36.     }
  37. }