42 lines
1.8 KiB
PHP
42 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* Mueve el perfil de software de Image (entidad lógica) a ImageImageRepository
|
|
* (la versión/copia concreta de la imagen en un repositorio), para poder
|
|
* conservar y editar el perfil de software por versión.
|
|
*/
|
|
final class Version20260710114751 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Mueve software_profile_id de image a image_image_repository';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045FED42A742');
|
|
$this->addSql('DROP INDEX IDX_C53D045FED42A742 ON image');
|
|
$this->addSql('ALTER TABLE image DROP software_profile_id');
|
|
$this->addSql('ALTER TABLE image_image_repository ADD software_profile_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B7851337ED42A742 FOREIGN KEY (software_profile_id) REFERENCES software_profile (id)');
|
|
$this->addSql('CREATE INDEX IDX_B7851337ED42A742 ON image_image_repository (software_profile_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE image_image_repository DROP FOREIGN KEY FK_B7851337ED42A742');
|
|
$this->addSql('DROP INDEX IDX_B7851337ED42A742 ON image_image_repository');
|
|
$this->addSql('ALTER TABLE image_image_repository DROP software_profile_id');
|
|
$this->addSql('ALTER TABLE image ADD software_profile_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045FED42A742 FOREIGN KEY (software_profile_id) REFERENCES software_profile (id)');
|
|
$this->addSql('CREATE INDEX IDX_C53D045FED42A742 ON image (software_profile_id)');
|
|
}
|
|
}
|