migrations

This commit is contained in:
Olivier PARPAILLON
2024-11-19 11:29:06 +01:00
parent a5bc958e78
commit 51fcbba8b2
7 changed files with 67 additions and 117 deletions

View File

@@ -1,31 +0,0 @@
<?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 Version20241119100530 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
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}

View File

@@ -1,31 +0,0 @@
<?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 Version20241119100721 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
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}

View File

@@ -1,49 +0,0 @@
<?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 Version20241119101002 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 ADD CONSTRAINT FK_2F577D59A73F0036 FOREIGN KEY (ville_id) REFERENCES ville (idVille)');
$this->addSql('DROP INDEX IDX_D79F6B11F6BD1646 ON participant');
$this->addSql('ALTER TABLE participant ADD id_site CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', ADD email VARCHAR(255) NOT NULL, DROP site_id, DROP mail');
$this->addSql('ALTER TABLE participant ADD CONSTRAINT FK_D79F6B11E26315E6 FOREIGN KEY (id_site) REFERENCES site (id_site)');
$this->addSql('CREATE INDEX IDX_D79F6B11E26315E6 ON participant (id_site)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON participant (email)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2F6BD1646 FOREIGN KEY (site_id) REFERENCES site (idSite)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F29D1C3019 FOREIGN KEY (participant_id) REFERENCES participant (idParticipant)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F26AB213CC FOREIGN KEY (lieu_id) REFERENCES lieu (idLieu)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2D5E86FF FOREIGN KEY (etat_id) REFERENCES etat (idEtat)');
}
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('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2F6BD1646');
$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('ALTER TABLE participant DROP FOREIGN KEY FK_D79F6B11E26315E6');
$this->addSql('DROP INDEX IDX_D79F6B11E26315E6 ON participant');
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_EMAIL ON participant');
$this->addSql('ALTER TABLE participant ADD site_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ADD mail VARCHAR(255) DEFAULT NULL, DROP id_site, DROP email');
$this->addSql('CREATE INDEX IDX_D79F6B11F6BD1646 ON participant (site_id)');
}
}

View File

@@ -0,0 +1,61 @@
<?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');
}
}