<?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 Version20230911102654 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('ALTER TABLE binding_files_travels DROP FOREIGN KEY FK_68A5CDA587F9B921');
$this->addSql('ALTER TABLE binding_files_travels DROP FOREIGN KEY FK_68A5CDA5F2AC22B');
$this->addSql('DROP TABLE binding_files_travels');
$this->addSql('ALTER TABLE service_travels_files ADD application_id INT NOT NULL');
$this->addSql('ALTER TABLE service_travels_files ADD CONSTRAINT FK_7605FF913E030ACD FOREIGN KEY (application_id) REFERENCES `crm_equipments_applications` (id)');
$this->addSql('CREATE INDEX IDX_7605FF913E030ACD ON service_travels_files (application_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE binding_files_travels (file_entity_id INT NOT NULL, travel_entity_id INT NOT NULL, INDEX IDX_68A5CDA5F2AC22B (file_entity_id), INDEX IDX_68A5CDA587F9B921 (travel_entity_id), PRIMARY KEY(file_entity_id, travel_entity_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE binding_files_travels ADD CONSTRAINT FK_68A5CDA587F9B921 FOREIGN KEY (travel_entity_id) REFERENCES service_travels (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE binding_files_travels ADD CONSTRAINT FK_68A5CDA5F2AC22B FOREIGN KEY (file_entity_id) REFERENCES service_travels_files (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE `service_travels_files` DROP FOREIGN KEY FK_7605FF913E030ACD');
$this->addSql('DROP INDEX IDX_7605FF913E030ACD ON `service_travels_files`');
$this->addSql('ALTER TABLE `service_travels_files` DROP application_id');
}
}