<?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 Version20220818115451 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 referentiel_categorie (id INT AUTO_INCREMENT NOT NULL, deleted_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, code VARCHAR(190) NOT NULL, enable TINYINT(1) DEFAULT \'1\', libelle VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_57CE194A77153098 (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, firstname VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE referentiel_client ADD src_client_id INT DEFAULT NULL, ADD categorie_id INT DEFAULT NULL, ADD interne TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE referentiel_client ADD CONSTRAINT FK_BF9976C0BEF019D0 FOREIGN KEY (src_client_id) REFERENCES referentiel_client (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE referentiel_client ADD CONSTRAINT FK_BF9976C0BCF5E72D FOREIGN KEY (categorie_id) REFERENCES referentiel_categorie (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE transcode_flux ADD comptabilite VARCHAR(255) DEFAULT NULL, ADD commentaire LONGTEXT DEFAULT NULL');
$this->addSql('CREATE INDEX IDX_BF9976C0BEF019D0 ON referentiel_client (src_client_id)');
$this->addSql('CREATE INDEX IDX_BF9976C0BCF5E72D ON referentiel_client (categorie_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE referentiel_client DROP FOREIGN KEY FK_BF9976C0BCF5E72D');
$this->addSql('DROP TABLE referentiel_categorie');
$this->addSql('DROP TABLE user');
$this->addSql('ALTER TABLE referentiel_client DROP FOREIGN KEY FK_BF9976C0BEF019D0');
$this->addSql('DROP INDEX IDX_BF9976C0BEF019D0 ON referentiel_client');
$this->addSql('DROP INDEX IDX_BF9976C0BCF5E72D ON referentiel_client');
$this->addSql('ALTER TABLE referentiel_client DROP src_client_id, DROP categorie_id, DROP interne');
$this->addSql('ALTER TABLE transcode_flux DROP comptabilite, DROP commentaire');
}
}