<?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 Version20220817071543 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 city (id INT AUTO_INCREMENT NOT NULL, department_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, active TINYINT(1) DEFAULT 1, position INT NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, UNIQUE INDEX UNIQ_2D5B0234989D9B62 (slug), INDEX IDX_2D5B0234AE80F5DF (department_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE department (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, active TINYINT(1) DEFAULT 1, position INT NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, UNIQUE INDEX UNIQ_CD1DE18A989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE establishment (id INT AUTO_INCREMENT NOT NULL, city_id INT DEFAULT NULL, category_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, manager VARCHAR(255) NOT NULL, phone VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, active TINYINT(1) DEFAULT 1, position INT NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, UNIQUE INDEX UNIQ_DBEFB1EE989D9B62 (slug), INDEX IDX_DBEFB1EE8BAC62AF (city_id), INDEX IDX_DBEFB1EE12469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE establishment_category (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, icon JSON NOT NULL, active TINYINT(1) DEFAULT 1, show_in_form_quotation_services TINYINT(1) DEFAULT 1, position INT NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, UNIQUE INDEX UNIQ_4D35EAF3989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE network (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, text_1 VARCHAR(255) DEFAULT NULL, text_2 VARCHAR(255) DEFAULT NULL, text_3 VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE city ADD CONSTRAINT FK_2D5B0234AE80F5DF FOREIGN KEY (department_id) REFERENCES department (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE establishment ADD CONSTRAINT FK_DBEFB1EE8BAC62AF FOREIGN KEY (city_id) REFERENCES city (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE establishment ADD CONSTRAINT FK_DBEFB1EE12469DE2 FOREIGN KEY (category_id) REFERENCES establishment_category (id) ON DELETE SET NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE city DROP FOREIGN KEY FK_2D5B0234AE80F5DF');
$this->addSql('ALTER TABLE establishment DROP FOREIGN KEY FK_DBEFB1EE8BAC62AF');
$this->addSql('ALTER TABLE establishment DROP FOREIGN KEY FK_DBEFB1EE12469DE2');
$this->addSql('DROP TABLE city');
$this->addSql('DROP TABLE department');
$this->addSql('DROP TABLE establishment');
$this->addSql('DROP TABLE establishment_category');
$this->addSql('DROP TABLE network');
}
}