migrations/Version20251107204231.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 Version20251107204231 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 audit_event (id INT AUTO_INCREMENT NOT NULL, actor_id INT DEFAULT NULL, impersonator_id INT DEFAULT NULL, request_id VARCHAR(255) DEFAULT NULL, ip_address VARCHAR(255) DEFAULT NULL, user_agent VARCHAR(255) DEFAULT NULL, route VARCHAR(255) DEFAULT NULL, method VARCHAR(255) DEFAULT NULL, event_type VARCHAR(255) NOT NULL, target_type VARCHAR(255) DEFAULT NULL, target_id VARCHAR(255) DEFAULT NULL, operation VARCHAR(255) DEFAULT NULL, changes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', created_at DATETIME NOT NULL, INDEX IDX_3CE56E50D1107CFF (impersonator_id), INDEX idx_actor (actor_id), INDEX idx_target (target_type, target_id), INDEX idx_type (event_type), INDEX idx_time (created_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE audit_event ADD CONSTRAINT FK_3CE56E5010DAF24A FOREIGN KEY (actor_id) REFERENCES user (id) ON DELETE SET NULL');
  20.         $this->addSql('ALTER TABLE audit_event ADD CONSTRAINT FK_3CE56E50D1107CFF FOREIGN KEY (impersonator_id) REFERENCES user (id) ON DELETE SET NULL');
  21.     }
  22.     public function down(Schema $schema): void
  23.     {
  24.         // this down() migration is auto-generated, please modify it to your needs
  25.         $this->addSql('DROP TABLE audit_event');
  26.     }
  27. }