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.

40 lines
1.7 KiB

4 months ago
  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 Version20240720143743 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__project AS SELECT id, name, description FROM project');
  19. $this->addSql('DROP TABLE project');
  20. $this->addSql('CREATE TABLE project (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description CLOB DEFAULT NULL, slug VARCHAR(255) NOT NULL)');
  21. $this->addSql('INSERT INTO project (id, name, description) SELECT id, name, description FROM __temp__project');
  22. $this->addSql('DROP TABLE __temp__project');
  23. $this->addSql('CREATE UNIQUE INDEX UNIQ_2FB3D0EE989D9B62 ON project (slug)');
  24. }
  25. public function down(Schema $schema): void
  26. {
  27. // this down() migration is auto-generated, please modify it to your needs
  28. $this->addSql('CREATE TEMPORARY TABLE __temp__project AS SELECT id, name, description FROM project');
  29. $this->addSql('DROP TABLE project');
  30. $this->addSql('CREATE TABLE project (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description CLOB DEFAULT NULL)');
  31. $this->addSql('INSERT INTO project (id, name, description) SELECT id, name, description FROM __temp__project');
  32. $this->addSql('DROP TABLE __temp__project');
  33. }
  34. }