|
<?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 Version20240726180444 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 TEMPORARY TABLE __temp__comment AS SELECT id, task_id, content FROM comment');
|
|
$this->addSql('DROP TABLE comment');
|
|
$this->addSql('CREATE TABLE comment (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, task_id INTEGER NOT NULL, created_by_id INTEGER NOT NULL, content CLOB NOT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
|
|
, CONSTRAINT FK_9474526C8DB60186 FOREIGN KEY (task_id) REFERENCES task (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_9474526CB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
|
$this->addSql('INSERT INTO comment (id, task_id, content) SELECT id, task_id, content FROM __temp__comment');
|
|
$this->addSql('DROP TABLE __temp__comment');
|
|
$this->addSql('CREATE INDEX IDX_9474526C8DB60186 ON comment (task_id)');
|
|
$this->addSql('CREATE INDEX IDX_9474526CB03A8386 ON comment (created_by_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('CREATE TEMPORARY TABLE __temp__comment AS SELECT id, task_id, content FROM comment');
|
|
$this->addSql('DROP TABLE comment');
|
|
$this->addSql('CREATE TABLE comment (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, task_id INTEGER NOT NULL, content CLOB NOT NULL, CONSTRAINT FK_9474526C8DB60186 FOREIGN KEY (task_id) REFERENCES task (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
|
$this->addSql('INSERT INTO comment (id, task_id, content) SELECT id, task_id, content FROM __temp__comment');
|
|
$this->addSql('DROP TABLE __temp__comment');
|
|
$this->addSql('CREATE INDEX IDX_9474526C8DB60186 ON comment (task_id)');
|
|
}
|
|
}
|