<?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 Version20220619153247 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 activity (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, date_start DATETIME DEFAULT NULL, date_end DATETIME NOT NULL, date_register_start DATETIME NOT NULL, date_register_end DATETIME NOT NULL, price NUMERIC(5, 2) NOT NULL, note LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, type VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE school_activity (id INT AUTO_INCREMENT NOT NULL, themes LONGTEXT NOT NULL, duration VARCHAR(255) NOT NULL, periodes VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE school_activity_class_level (school_activity_id INT NOT NULL, class_level_id INT NOT NULL, INDEX IDX_14F55CD7D2C65226 (school_activity_id), INDEX IDX_14F55CD7EB7F80F7 (class_level_id), PRIMARY KEY(school_activity_id, class_level_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE stage_activity (id INT AUTO_INCREMENT NOT NULL, language VARCHAR(255) NOT NULL, max_kids INT NOT NULL, age_from INT NOT NULL, age_to INT NOT NULL, validated TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE school_activity_class_level ADD CONSTRAINT FK_14F55CD7D2C65226 FOREIGN KEY (school_activity_id) REFERENCES school_activity (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE school_activity_class_level ADD CONSTRAINT FK_14F55CD7EB7F80F7 FOREIGN KEY (class_level_id) REFERENCES class_level (id) ON DELETE CASCADE');
$this->addSql('DROP TABLE ecole_activity');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE school_activity_class_level DROP FOREIGN KEY FK_14F55CD7D2C65226');
$this->addSql('CREATE TABLE ecole_activity (id INT AUTO_INCREMENT NOT NULL, themes LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, duration VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, periodes VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('DROP TABLE activity');
$this->addSql('DROP TABLE school_activity');
$this->addSql('DROP TABLE school_activity_class_level');
$this->addSql('DROP TABLE stage_activity');
}
}