migrations/Version20230911131203.php line 1
<?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 Version20230911131203 extends AbstractMigration
{
public function getDescription(): string
{
return 'add wiki_course and wiki_course_post table';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE wiki_course (id INT AUTO_INCREMENT NOT NULL, author_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_F23F2A8BF675F31B (author_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE wiki_course_post (course_id INT NOT NULL, post_id INT NOT NULL, INDEX IDX_7ABF3DD591CC992 (course_id), INDEX IDX_7ABF3DD4B89032C (post_id), PRIMARY KEY(course_id, post_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE wiki_course ADD CONSTRAINT FK_F23F2A8BF675F31B FOREIGN KEY (author_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE wiki_course_post ADD CONSTRAINT FK_7ABF3DD591CC992 FOREIGN KEY (course_id) REFERENCES wiki_course (id)');
$this->addSql('ALTER TABLE wiki_course_post ADD CONSTRAINT FK_7ABF3DD4B89032C FOREIGN KEY (post_id) REFERENCES wiki_post (id)');
$this->addSql('ALTER TABLE sale_upwork_rss CHANGE url url VARCHAR(510) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE wiki_course DROP FOREIGN KEY FK_F23F2A8BF675F31B');
$this->addSql('ALTER TABLE wiki_course_post DROP FOREIGN KEY FK_7ABF3DD591CC992');
$this->addSql('ALTER TABLE wiki_course_post DROP FOREIGN KEY FK_7ABF3DD4B89032C');
$this->addSql('DROP TABLE wiki_course');
$this->addSql('DROP TABLE wiki_course_post');
$this->addSql('ALTER TABLE sale_upwork_rss CHANGE url url VARCHAR(255) NOT NULL');
}
}