<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250910095657 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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');
$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');
$this->addSql('ALTER TABLE purchase_order_files ADD CONSTRAINT FK_FE162C5DA45D7E6A FOREIGN KEY (purchase_order_id) REFERENCES purchase_order (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE purchase_order_files ADD CONSTRAINT FK_FE162C5D93CB796C FOREIGN KEY (file_id) REFERENCES files (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE purchase_order_files DROP FOREIGN KEY FK_FE162C5DA45D7E6A');
$this->addSql('ALTER TABLE purchase_order_files DROP FOREIGN KEY FK_FE162C5D93CB796C');
$this->addSql('DROP TABLE files');
$this->addSql('DROP TABLE purchase_order_files');
}
}