<?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 Version20220818153245 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_adresse_voisine (id INT AUTO_INCREMENT NOT NULL, pays_id INT DEFAULT NULL, client_id INT DEFAULT NULL, departement VARCHAR(50) NOT NULL, ville VARCHAR(255) NOT NULL, code VARCHAR(190) NOT NULL, enable TINYINT(1) DEFAULT \'1\', libelle VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_6A727DD577153098 (code), INDEX IDX_6A727DD5A6E44244 (pays_id), INDEX IDX_6A727DD519EB6921 (client_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE referentiel_pays (id INT AUTO_INCREMENT NOT NULL, code_alpha2 VARCHAR(2) NOT NULL, code_alpha3 VARCHAR(3) NOT NULL, code_numerique VARCHAR(10) DEFAULT NULL, code_tel VARCHAR(20) DEFAULT NULL, libelle_fr VARCHAR(150) NOT NULL, libelle_en VARCHAR(150) NOT NULL, libelle_nl VARCHAR(150) DEFAULT NULL, libelle_es VARCHAR(150) NOT NULL, libelle_de VARCHAR(150) DEFAULT NULL, libelle_technique VARCHAR(150) NOT NULL, type VARCHAR(10) NOT NULL, is_visu_client TINYINT(1) 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\', UNIQUE INDEX UNIQ_EF10A4C577153098 (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE referentiel_adresse_voisine ADD CONSTRAINT FK_6A727DD5A6E44244 FOREIGN KEY (pays_id) REFERENCES referentiel_pays (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE referentiel_adresse_voisine ADD CONSTRAINT FK_6A727DD519EB6921 FOREIGN KEY (client_id) REFERENCES referentiel_client (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE referentiel_client ADD code_wexlog VARCHAR(190) DEFAULT NULL, ADD pays_id INT DEFAULT NULL, ADD libelle2 VARCHAR(255) DEFAULT NULL, ADD adresse VARCHAR(255) DEFAULT NULL, ADD adresse2 VARCHAR(255) DEFAULT NULL, ADD departement VARCHAR(50) DEFAULT NULL, ADD code_postal VARCHAR(50) DEFAULT NULL, ADD ville VARCHAR(255) DEFAULT NULL, ADD contact_nom VARCHAR(150) DEFAULT NULL, ADD contact_tel_fixe VARCHAR(100) DEFAULT NULL, ADD contact_tel_fixe2 VARCHAR(100) DEFAULT NULL, ADD contact_tel_portable VARCHAR(100) DEFAULT NULL, ADD contact_fax VARCHAR(100) DEFAULT NULL, ADD contact_email VARCHAR(150) DEFAULT NULL');
$this->addSql('ALTER TABLE referentiel_client ADD CONSTRAINT FK_BF9976C0A6E44244 FOREIGN KEY (pays_id) REFERENCES referentiel_pays (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_BF9976C0A6E44244 ON referentiel_client (pays_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE referentiel_adresse_voisine DROP FOREIGN KEY FK_6A727DD5A6E44244');
$this->addSql('ALTER TABLE referentiel_client DROP FOREIGN KEY FK_BF9976C0A6E44244');
$this->addSql('DROP TABLE referentiel_adresse_voisine');
$this->addSql('DROP TABLE referentiel_pays');
$this->addSql('DROP INDEX IDX_BF9976C0A6E44244 ON referentiel_client');
$this->addSql('ALTER TABLE referentiel_client DROP code_wexlog, DROP pays_id, DROP libelle2, DROP adresse, DROP adresse2, DROP departement, DROP code_postal, DROP ville, DROP contact_nom, DROP contact_tel_fixe, DROP contact_tel_fixe2, DROP contact_tel_portable, DROP contact_fax, DROP contact_email');
}
}