migrations/Version20250910095657.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 Version20250910095657 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 files (id INT AUTO_INCREMENT NOT NULL, s3_path VARCHAR(500) NOT NULL, filename VARCHAR(255) NOT NULL, file_size BIGINT DEFAULT NULL, description LONGTEXT DEFAULT NULL, mime_type VARCHAR(100) DEFAULT NULL, uuid VARCHAR(36) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE purchase_order_files (purchase_order_id INT NOT NULL, file_id INT NOT NULL, INDEX IDX_FE162C5DA45D7E6A (purchase_order_id), INDEX IDX_FE162C5D93CB796C (file_id), PRIMARY KEY(purchase_order_id, file_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE purchase_order_files ADD CONSTRAINT FK_FE162C5DA45D7E6A FOREIGN KEY (purchase_order_id) REFERENCES purchase_order (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE purchase_order_files ADD CONSTRAINT FK_FE162C5D93CB796C FOREIGN KEY (file_id) REFERENCES files (id) ON DELETE CASCADE');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->addSql('ALTER TABLE purchase_order_files DROP FOREIGN KEY FK_FE162C5DA45D7E6A');
  27.         $this->addSql('ALTER TABLE purchase_order_files DROP FOREIGN KEY FK_FE162C5D93CB796C');
  28.         $this->addSql('DROP TABLE files');
  29.         $this->addSql('DROP TABLE purchase_order_files');
  30.     }
  31. }