<?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 Version20220622193151 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, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE school_activity ADD activity_id INT NOT NULL, DROP title, DROP slug, DROP description, DROP date_start, DROP date_end, DROP date_register_start, DROP date_register_end, DROP price, DROP note, DROP created_at, DROP updated_at');
$this->addSql('ALTER TABLE school_activity ADD CONSTRAINT FK_52323D1E81C06096 FOREIGN KEY (activity_id) REFERENCES activity (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_52323D1E81C06096 ON school_activity (activity_id)');
$this->addSql('ALTER TABLE stage_activity ADD activity_id INT NOT NULL, DROP title, DROP slug, DROP description, DROP date_start, DROP date_end, DROP date_register_start, DROP date_register_end, DROP price, DROP note, DROP created_at, DROP updated_at');
$this->addSql('ALTER TABLE stage_activity ADD CONSTRAINT FK_A493CD3781C06096 FOREIGN KEY (activity_id) REFERENCES activity (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A493CD3781C06096 ON stage_activity (activity_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE school_activity DROP FOREIGN KEY FK_52323D1E81C06096');
$this->addSql('ALTER TABLE stage_activity DROP FOREIGN KEY FK_A493CD3781C06096');
$this->addSql('DROP TABLE activity');
$this->addSql('DROP INDEX UNIQ_52323D1E81C06096 ON school_activity');
$this->addSql('ALTER TABLE school_activity ADD title VARCHAR(255) NOT NULL, ADD slug VARCHAR(255) NOT NULL, ADD description LONGTEXT NOT NULL, ADD date_start DATETIME DEFAULT NULL, ADD date_end DATETIME NOT NULL, ADD date_register_start DATETIME NOT NULL, ADD date_register_end DATETIME NOT NULL, ADD price NUMERIC(5, 2) NOT NULL, ADD note LONGTEXT DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP activity_id');
$this->addSql('DROP INDEX UNIQ_A493CD3781C06096 ON stage_activity');
$this->addSql('ALTER TABLE stage_activity ADD title VARCHAR(255) NOT NULL, ADD slug VARCHAR(255) NOT NULL, ADD description LONGTEXT NOT NULL, ADD date_start DATETIME DEFAULT NULL, ADD date_end DATETIME NOT NULL, ADD date_register_start DATETIME NOT NULL, ADD date_register_end DATETIME NOT NULL, ADD price NUMERIC(5, 2) NOT NULL, ADD note LONGTEXT DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP activity_id');
}
}