mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-12 21:29:33 +00:00
25 lines
862 B
PHP
25 lines
862 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
final class Version20250304154507 extends AbstractMigration
|
|
{
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE parts ADD built_assembly_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE parts ADD CONSTRAINT FK_6940A7FECC660B3C FOREIGN KEY (built_assembly_id) REFERENCES assemblies (id)');
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_6940A7FECC660B3C ON parts (built_assembly_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FECC660B3C');
|
|
$this->addSql('DROP INDEX UNIQ_6940A7FECC660B3C ON `parts`');
|
|
$this->addSql('ALTER TABLE `parts` DROP built_assembly_id');
|
|
}
|
|
}
|