<?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 Version20230509114759 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('CREATE TABLE contrat (id INT AUTO_INCREMENT NOT NULL, numero VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, date DATE NOT NULL, status VARCHAR(255) NOT NULL, commentaire LONGTEXT NOT NULL, file VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE contrat_signe (id INT AUTO_INCREMENT NOT NULL, contrat_id INT DEFAULT NULL, installateur_id INT DEFAULT NULL, date DATE NOT NULL, status VARCHAR(255) NOT NULL, file VARCHAR(255) NOT NULL, commentaire LONGTEXT NOT NULL, INDEX IDX_4F02B2161823061F (contrat_id), INDEX IDX_4F02B21651262FCB (installateur_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE contrat_signe ADD CONSTRAINT FK_4F02B2161823061F FOREIGN KEY (contrat_id) REFERENCES contrat (id)');
$this->addSql('ALTER TABLE contrat_signe ADD CONSTRAINT FK_4F02B21651262FCB FOREIGN KEY (installateur_id) REFERENCES installateur (id)');
$this->addSql('ALTER TABLE deal ADD contrat_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE deal ADD CONSTRAINT FK_E3FEC1161823061F FOREIGN KEY (contrat_id) REFERENCES contrat (id)');
$this->addSql('CREATE INDEX IDX_E3FEC1161823061F ON deal (contrat_id)');
$this->addSql('ALTER TABLE equipe CHANGE permissions permissions JSON NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE contrat_signe DROP FOREIGN KEY FK_4F02B2161823061F');
$this->addSql('ALTER TABLE deal DROP FOREIGN KEY FK_E3FEC1161823061F');
$this->addSql('DROP TABLE contrat');
$this->addSql('DROP TABLE contrat_signe');
$this->addSql('DROP INDEX IDX_E3FEC1161823061F ON deal');
$this->addSql('ALTER TABLE deal DROP contrat_id');
$this->addSql('ALTER TABLE equipe CHANGE permissions permissions LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:array)\'');
}
}