62 lines
3.8 KiB
PHP
62 lines
3.8 KiB
PHP
<?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 Version20241119102815 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 lieu DROP FOREIGN KEY FK_2F577D59AD4698F3');
|
|
$this->addSql('DROP INDEX IDX_2F577D59AD4698F3 ON lieu');
|
|
$this->addSql('ALTER TABLE lieu CHANGE id_ville ville_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\'');
|
|
$this->addSql('ALTER TABLE lieu ADD CONSTRAINT FK_2F577D59A73F0036 FOREIGN KEY (ville_id) REFERENCES ville (id_ville)');
|
|
$this->addSql('CREATE INDEX IDX_2F577D59A73F0036 ON lieu (ville_id)');
|
|
$this->addSql('DROP INDEX IDX_3C3FD3F2CF8DA6E6 ON sortie');
|
|
$this->addSql('DROP INDEX IDX_3C3FD3F2A477615B ON sortie');
|
|
$this->addSql('DROP INDEX IDX_3C3FD3F2DEEAEB60 ON sortie');
|
|
$this->addSql('ALTER TABLE sortie ADD participant_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ADD lieu_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ADD etat_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', DROP id_participant, DROP id_lieu, DROP id_etat');
|
|
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F29D1C3019 FOREIGN KEY (participant_id) REFERENCES participant (id_participant)');
|
|
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F26AB213CC FOREIGN KEY (lieu_id) REFERENCES lieu (id_lieu)');
|
|
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2D5E86FF FOREIGN KEY (etat_id) REFERENCES etat (id_etat)');
|
|
$this->addSql('CREATE INDEX IDX_3C3FD3F29D1C3019 ON sortie (participant_id)');
|
|
$this->addSql('CREATE INDEX IDX_3C3FD3F26AB213CC ON sortie (lieu_id)');
|
|
$this->addSql('CREATE INDEX IDX_3C3FD3F2D5E86FF ON sortie (etat_id)');
|
|
$this->addSql('ALTER TABLE sortie RENAME INDEX fk_3c3fd3f2f6bd1646 TO IDX_3C3FD3F2F6BD1646');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('ALTER TABLE lieu DROP FOREIGN KEY FK_2F577D59A73F0036');
|
|
$this->addSql('DROP INDEX IDX_2F577D59A73F0036 ON lieu');
|
|
$this->addSql('ALTER TABLE lieu CHANGE ville_id id_ville CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\'');
|
|
$this->addSql('ALTER TABLE lieu ADD CONSTRAINT FK_2F577D59AD4698F3 FOREIGN KEY (id_ville) REFERENCES ville (id_ville) ON UPDATE NO ACTION ON DELETE NO ACTION');
|
|
$this->addSql('CREATE INDEX IDX_2F577D59AD4698F3 ON lieu (id_ville)');
|
|
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F29D1C3019');
|
|
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F26AB213CC');
|
|
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2D5E86FF');
|
|
$this->addSql('DROP INDEX IDX_3C3FD3F29D1C3019 ON sortie');
|
|
$this->addSql('DROP INDEX IDX_3C3FD3F26AB213CC ON sortie');
|
|
$this->addSql('DROP INDEX IDX_3C3FD3F2D5E86FF ON sortie');
|
|
$this->addSql('ALTER TABLE sortie ADD id_participant CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ADD id_lieu CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ADD id_etat CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', DROP participant_id, DROP lieu_id, DROP etat_id');
|
|
$this->addSql('CREATE INDEX IDX_3C3FD3F2CF8DA6E6 ON sortie (id_participant)');
|
|
$this->addSql('CREATE INDEX IDX_3C3FD3F2A477615B ON sortie (id_lieu)');
|
|
$this->addSql('CREATE INDEX IDX_3C3FD3F2DEEAEB60 ON sortie (id_etat)');
|
|
$this->addSql('ALTER TABLE sortie RENAME INDEX idx_3c3fd3f2f6bd1646 TO FK_3C3FD3F2F6BD1646');
|
|
}
|
|
}
|