migrations/Version20230718073018.php line 1
<?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 Version20230718073018 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 client_nom_de_domaine DROP FOREIGN KEY FK_643BFEB7B72FEAC7');
$this->addSql('ALTER TABLE client_nom_de_domaine DROP FOREIGN KEY FK_643BFEB719EB6921');
$this->addSql('DROP TABLE event_time');
$this->addSql('DROP TABLE client_nom_de_domaine');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610537A1329');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610700047D2');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610537A1329 FOREIGN KEY (message_id) REFERENCES message (id)');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket (id)');
$this->addSql('ALTER TABLE history CHANGE changes changes LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'');
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307F700047D2');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket (id)');
$this->addSql('ALTER TABLE regie_update DROP FOREIGN KEY FK_35AD68D271F7E88B');
$this->addSql('ALTER TABLE regie_update DROP FOREIGN KEY FK_35AD68D246F21B0B');
$this->addSql('ALTER TABLE regie_update DROP FOREIGN KEY FK_35AD68D2700047D2');
$this->addSql('ALTER TABLE regie_update ADD CONSTRAINT FK_35AD68D271F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('ALTER TABLE regie_update ADD CONSTRAINT FK_35AD68D246F21B0B FOREIGN KEY (regie_id) REFERENCES regie (id)');
$this->addSql('ALTER TABLE regie_update ADD CONSTRAINT FK_35AD68D2700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket (id)');
$this->addSql('ALTER TABLE site ADD nom_de_domaine_principal_id INT DEFAULT NULL, CHANGE messagerie messagerie LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'');
$this->addSql('ALTER TABLE site ADD CONSTRAINT FK_694309E47A1E72AD FOREIGN KEY (nom_de_domaine_principal_id) REFERENCES nom_de_domaine (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_694309E47A1E72AD ON site (nom_de_domaine_principal_id)');
$this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA31823061F');
$this->addSql('ALTER TABLE ticket CHANGE projet_id projet_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE ticket ADD CONSTRAINT FK_97A0ADA31823061F FOREIGN KEY (contrat_id) REFERENCES type_intervention (id)');
$this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', CHANGE enabled enabled TINYINT(1) DEFAULT 1 NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE event_time (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, ticket_id INT DEFAULT NULL, site_id INT DEFAULT NULL, reference VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, start_date DATETIME NOT NULL, end_date DATETIME DEFAULT NULL, duration DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_3BAE0AA7700047D2 (ticket_id), INDEX IDX_3BAE0AA7F6BD1646 (site_id), UNIQUE INDEX UNIQ_3BAE0AA7AEA34913 (reference), INDEX IDX_3BAE0AA7B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE client_nom_de_domaine (client_id INT NOT NULL, nom_de_domaine_id INT NOT NULL, INDEX IDX_643BFEB719EB6921 (client_id), INDEX IDX_643BFEB7B72FEAC7 (nom_de_domaine_id), PRIMARY KEY(client_id, nom_de_domaine_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE client_nom_de_domaine ADD CONSTRAINT FK_643BFEB7B72FEAC7 FOREIGN KEY (nom_de_domaine_id) REFERENCES nom_de_domaine (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE client_nom_de_domaine ADD CONSTRAINT FK_643BFEB719EB6921 FOREIGN KEY (client_id) REFERENCES client (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE regie_update DROP FOREIGN KEY FK_35AD68D2700047D2');
$this->addSql('ALTER TABLE regie_update DROP FOREIGN KEY FK_35AD68D271F7E88B');
$this->addSql('ALTER TABLE regie_update DROP FOREIGN KEY FK_35AD68D246F21B0B');
$this->addSql('ALTER TABLE regie_update ADD CONSTRAINT FK_35AD68D2700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE regie_update ADD CONSTRAINT FK_35AD68D271F7E88B FOREIGN KEY (event_id) REFERENCES event (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE regie_update ADD CONSTRAINT FK_35AD68D246F21B0B FOREIGN KEY (regie_id) REFERENCES regie (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE `utf8mb4_bin`, CHANGE enabled enabled TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA31823061F');
$this->addSql('ALTER TABLE ticket CHANGE projet_id projet_id INT NOT NULL');
$this->addSql('ALTER TABLE ticket ADD CONSTRAINT FK_97A0ADA31823061F FOREIGN KEY (contrat_id) REFERENCES type_intervention (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE site DROP FOREIGN KEY FK_694309E47A1E72AD');
$this->addSql('DROP INDEX UNIQ_694309E47A1E72AD ON site');
$this->addSql('ALTER TABLE site DROP nom_de_domaine_principal_id, CHANGE messagerie messagerie LONGTEXT NOT NULL COLLATE `utf8mb4_bin`');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610700047D2');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610537A1329');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610537A1329 FOREIGN KEY (message_id) REFERENCES message (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE history CHANGE changes changes LONGTEXT NOT NULL COLLATE `utf8mb4_bin`');
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307F700047D2');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket (id) ON DELETE CASCADE');
}
}