2025-02-22 17:58:20 +01:00
|
|
|
<?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 Version20250222165240 extends AbstractMigration
|
|
|
|
{
|
|
|
|
public function getDescription(): string
|
|
|
|
{
|
|
|
|
return 'Migrate the old attachment class discriminator values from legacy Part-DB to the modern format, so that there is just one unified value';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function up(Schema $schema): void
|
|
|
|
{
|
|
|
|
//Change the old discriminator values to the new ones
|
2025-02-22 18:03:03 +01:00
|
|
|
$this->addSql("UPDATE attachments SET class_name = 'Part' WHERE class_name = 'PartDB\Part'");
|
2025-02-22 19:23:28 +01:00
|
|
|
$this->addSql("UPDATE attachments SET class_name = 'Device' WHERE class_name = 'PartDB\Device'");
|
2025-02-22 17:58:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function down(Schema $schema): void
|
|
|
|
{
|
|
|
|
//No down required, as the new format can also be read by older Part-DB version
|
|
|
|
}
|
|
|
|
}
|