<?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 Version20211230151429 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 activite (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(255) NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE entreprise ADD activite_id INT DEFAULT NULL, ADD forme_juridique VARCHAR(255) DEFAULT NULL, ADD dirigeant_nom VARCHAR(255) DEFAULT NULL, ADD dirigeant_prenom VARCHAR(255) DEFAULT NULL, ADD contact_telephone VARCHAR(255) DEFAULT NULL, ADD contact_email VARCHAR(255) DEFAULT NULL, ADD adresse VARCHAR(255) DEFAULT NULL, ADD code_postal VARCHAR(255) DEFAULT NULL, ADD commune VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE entreprise ADD CONSTRAINT FK_D19FA609B0F88B1 FOREIGN KEY (activite_id) REFERENCES activite (id)');
$this->addSql('CREATE INDEX IDX_D19FA609B0F88B1 ON entreprise (activite_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE entreprise DROP FOREIGN KEY FK_D19FA609B0F88B1');
$this->addSql('DROP TABLE activite');
$this->addSql('DROP INDEX IDX_D19FA609B0F88B1 ON entreprise');
$this->addSql('ALTER TABLE entreprise DROP activite_id, DROP forme_juridique, DROP dirigeant_nom, DROP dirigeant_prenom, DROP contact_telephone, DROP contact_email, DROP adresse, DROP code_postal, DROP commune');
}
}