migrations/Version20230908104541.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 Version20230908104541 extends AbstractMigration
{
public function getDescription(): string
{
return 'add wiki_post_read';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE wiki_post_read (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, post_id INT DEFAULT NULL, created_at DATETIME NOT NULL, INDEX IDX_5A323F48A76ED395 (user_id), INDEX IDX_5A323F484B89032C (post_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE wiki_post_read ADD CONSTRAINT FK_5A323F48A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE wiki_post_read ADD CONSTRAINT FK_5A323F484B89032C FOREIGN KEY (post_id) REFERENCES wiki_post (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE wiki_post_read DROP FOREIGN KEY FK_5A323F48A76ED395');
$this->addSql('ALTER TABLE wiki_post_read DROP FOREIGN KEY FK_5A323F484B89032C');
$this->addSql('DROP TABLE wiki_post_read');
}
}