<?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 Version20240424083539 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 department (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, message LONGTEXT 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_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, department_id INT DEFAULT NULL, category_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, phones JSON NOT NULL, emails JSON NOT NULL, map_link LONGTEXT 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_DBEFB1EEAE80F5DF (department_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, icon JSON 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_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, banner_image JSON NOT NULL, banner_text VARCHAR(255) DEFAULT NULL, text VARCHAR(255) DEFAULT NULL, no_results VARCHAR(255) NOT 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 establishment ADD CONSTRAINT FK_DBEFB1EEAE80F5DF FOREIGN KEY (department_id) REFERENCES department (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 establishment DROP FOREIGN KEY FK_DBEFB1EEAE80F5DF');
$this->addSql('ALTER TABLE establishment DROP FOREIGN KEY FK_DBEFB1EE12469DE2');
$this->addSql('DROP TABLE department');
$this->addSql('DROP TABLE establishment');
$this->addSql('DROP TABLE establishment_category');
$this->addSql('DROP TABLE network');
}
}