<?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 Version20210707092457 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 categorie (id INT AUTO_INCREMENT NOT NULL, designation VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE entiteeconomique (id INT AUTO_INCREMENT NOT NULL, designation VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, adresse LONGTEXT DEFAULT NULL, tel VARCHAR(150) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE entiteeconomique_categorie (entiteeconomique_id INT NOT NULL, categorie_id INT NOT NULL, INDEX IDX_B7E489AFF48CE937 (entiteeconomique_id), INDEX IDX_B7E489AFBCF5E72D (categorie_id), PRIMARY KEY(entiteeconomique_id, categorie_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE entiteeconomique_ile (entiteeconomique_id INT NOT NULL, ile_id INT NOT NULL, INDEX IDX_9F4AD9B4F48CE937 (entiteeconomique_id), INDEX IDX_9F4AD9B457037E6E (ile_id), PRIMARY KEY(entiteeconomique_id, ile_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ile (id INT AUTO_INCREMENT NOT NULL, designation VARCHAR(100) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE images_entiteeconomique (id INT AUTO_INCREMENT NOT NULL, entiteeconomique_id INT NOT NULL, designation VARCHAR(255) NOT NULL, is_thumb TINYINT(1) NOT NULL, INDEX IDX_6240EE0EF48CE937 (entiteeconomique_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE entiteeconomique_categorie ADD CONSTRAINT FK_B7E489AFF48CE937 FOREIGN KEY (entiteeconomique_id) REFERENCES entiteeconomique (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE entiteeconomique_categorie ADD CONSTRAINT FK_B7E489AFBCF5E72D FOREIGN KEY (categorie_id) REFERENCES categorie (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE entiteeconomique_ile ADD CONSTRAINT FK_9F4AD9B4F48CE937 FOREIGN KEY (entiteeconomique_id) REFERENCES entiteeconomique (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE entiteeconomique_ile ADD CONSTRAINT FK_9F4AD9B457037E6E FOREIGN KEY (ile_id) REFERENCES ile (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE images_entiteeconomique ADD CONSTRAINT FK_6240EE0EF48CE937 FOREIGN KEY (entiteeconomique_id) REFERENCES entiteeconomique (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE entiteeconomique_categorie DROP FOREIGN KEY FK_B7E489AFBCF5E72D');
$this->addSql('ALTER TABLE entiteeconomique_categorie DROP FOREIGN KEY FK_B7E489AFF48CE937');
$this->addSql('ALTER TABLE entiteeconomique_ile DROP FOREIGN KEY FK_9F4AD9B4F48CE937');
$this->addSql('ALTER TABLE images_entiteeconomique DROP FOREIGN KEY FK_6240EE0EF48CE937');
$this->addSql('ALTER TABLE entiteeconomique_ile DROP FOREIGN KEY FK_9F4AD9B457037E6E');
$this->addSql('DROP TABLE categorie');
$this->addSql('DROP TABLE entiteeconomique');
$this->addSql('DROP TABLE entiteeconomique_categorie');
$this->addSql('DROP TABLE entiteeconomique_ile');
$this->addSql('DROP TABLE ile');
$this->addSql('DROP TABLE images_entiteeconomique');
}
}