You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
2.2 KiB

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7. * Auto-generated Migration: Please modify to your needs!
  8. */
  9. final class Version20240726180444 extends AbstractMigration
  10. {
  11. public function getDescription(): string
  12. {
  13. return '';
  14. }
  15. public function up(Schema $schema): void
  16. {
  17. // this up() migration is auto-generated, please modify it to your needs
  18. $this->addSql('CREATE TEMPORARY TABLE __temp__comment AS SELECT id, task_id, content FROM comment');
  19. $this->addSql('DROP TABLE comment');
  20. $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)
  21. , 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)');
  22. $this->addSql('INSERT INTO comment (id, task_id, content) SELECT id, task_id, content FROM __temp__comment');
  23. $this->addSql('DROP TABLE __temp__comment');
  24. $this->addSql('CREATE INDEX IDX_9474526C8DB60186 ON comment (task_id)');
  25. $this->addSql('CREATE INDEX IDX_9474526CB03A8386 ON comment (created_by_id)');
  26. }
  27. public function down(Schema $schema): void
  28. {
  29. // this down() migration is auto-generated, please modify it to your needs
  30. $this->addSql('CREATE TEMPORARY TABLE __temp__comment AS SELECT id, task_id, content FROM comment');
  31. $this->addSql('DROP TABLE comment');
  32. $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)');
  33. $this->addSql('INSERT INTO comment (id, task_id, content) SELECT id, task_id, content FROM __temp__comment');
  34. $this->addSql('DROP TABLE __temp__comment');
  35. $this->addSql('CREATE INDEX IDX_9474526C8DB60186 ON comment (task_id)');
  36. }
  37. }