Rebase auf Part-DB v2.1.2

This commit is contained in:
Marcel Diegelmann 2025-09-10 13:56:36 +02:00
parent 7abc37fc9a
commit 360fed1f5e
33 changed files with 1020 additions and 162 deletions

View file

@ -18,42 +18,42 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
{
$this->addSql(<<<'SQL'
CREATE TABLE assemblies (
id INT AUTO_INCREMENT NOT NULL,
parent_id INT DEFAULT NULL,
id_preview_attachment INT DEFAULT NULL,
name VARCHAR(255) NOT NULL,
comment LONGTEXT NOT NULL,
not_selectable TINYINT(1) NOT NULL,
alternative_names LONGTEXT DEFAULT NULL,
order_quantity INT NOT NULL,
status VARCHAR(64) DEFAULT NULL,
order_only_missing_parts TINYINT(1) NOT NULL,
description LONGTEXT NOT NULL,
last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
INDEX IDX_5F3832C0727ACA70 (parent_id),
INDEX IDX_5F3832C0EA7100A1 (id_preview_attachment),
id INT AUTO_INCREMENT NOT NULL,
parent_id INT DEFAULT NULL,
id_preview_attachment INT DEFAULT NULL,
name VARCHAR(255) NOT NULL,
comment LONGTEXT NOT NULL,
not_selectable TINYINT(1) NOT NULL,
alternative_names LONGTEXT DEFAULT NULL,
order_quantity INT NOT NULL,
status VARCHAR(64) DEFAULT NULL,
order_only_missing_parts TINYINT(1) NOT NULL,
description LONGTEXT NOT NULL,
last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
INDEX IDX_5F3832C0727ACA70 (parent_id),
INDEX IDX_5F3832C0EA7100A1 (id_preview_attachment),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci`
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE assembly_bom_entries (
id INT AUTO_INCREMENT NOT NULL,
id_assembly INT DEFAULT NULL,
id_part INT DEFAULT NULL,
id_project INT DEFAULT NULL,
quantity DOUBLE PRECISION NOT NULL,
mountnames LONGTEXT NOT NULL,
name VARCHAR(255) DEFAULT NULL,
comment LONGTEXT NOT NULL,
price NUMERIC(11, 5) DEFAULT NULL,
price_currency_id INT DEFAULT NULL,
last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
INDEX IDX_8C74887E2F180363 (id_assembly),
INDEX IDX_8C74887EC22F6CC4 (id_part),
INDEX IDX_8C74887EF12E799E (id_project),
INDEX IDX_8C74887E3FFDCD60 (price_currency_id),
id INT AUTO_INCREMENT NOT NULL,
id_assembly INT DEFAULT NULL,
id_part INT DEFAULT NULL,
id_project INT DEFAULT NULL,
quantity DOUBLE PRECISION NOT NULL,
mountnames LONGTEXT NOT NULL,
name VARCHAR(255) DEFAULT NULL,
comment LONGTEXT NOT NULL,
price NUMERIC(11, 5) DEFAULT NULL,
price_currency_id INT DEFAULT NULL,
last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
INDEX IDX_8C74887E2F180363 (id_assembly),
INDEX IDX_8C74887EC22F6CC4 (id_part),
INDEX IDX_8C74887EF12E799E (id_project),
INDEX IDX_8C74887E3FFDCD60 (price_currency_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci`
SQL);
@ -109,7 +109,7 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
{
$this->addSql(<<<'SQL'
CREATE TABLE assemblies (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
parent_id INTEGER DEFAULT NULL,
id_preview_attachment INTEGER DEFAULT NULL,
order_quantity INTEGER NOT NULL,
@ -120,7 +120,7 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
status VARCHAR(64) DEFAULT NULL,
ipn VARCHAR(100) DEFAULT NULL,
ipn VARCHAR(100) DEFAULT NULL,
description CLOB NOT NULL,
alternative_names CLOB DEFAULT NULL,
CONSTRAINT FK_5F3832C0727ACA70 FOREIGN KEY (parent_id) REFERENCES assemblies (id) NOT DEFERRABLE INITIALLY IMMEDIATE,
@ -145,7 +145,6 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
id_assembly INTEGER DEFAULT NULL,
id_part INTEGER DEFAULT NULL,
id_project INTEGER DEFAULT NULL,
id_referenced_assembly INTEGER DEFAULT NULL,
price_currency_id INTEGER DEFAULT NULL,
quantity DOUBLE PRECISION NOT NULL,
@ -157,9 +156,8 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
CONSTRAINT FK_8C74887E4AD2039E FOREIGN KEY (id_assembly) REFERENCES assemblies (id) NOT DEFERRABLE INITIALLY IMMEDIATE,
CONSTRAINT FK_8C74887EC22F6CC4 FOREIGN KEY (id_part) REFERENCES "parts" (id) NOT DEFERRABLE INITIALLY IMMEDIATE,
CONSTRAINT FK_8C74887EF12E799E FOREIGN KEY (id_project) REFERENCES projects (id) NOT DEFERRABLE INITIALLY IMMEDIATE,
CONSTRAINT FK_8C74887E22522999 FOREIGN KEY (id_referenced_assembly) REFERENCES assemblies (id) ON UPDATE NO ACTION ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE,
CONSTRAINT FK_8C74887E3FFDCD60 FOREIGN KEY (price_currency_id) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE
CONSTRAINT FK_8C74887E22522999 FOREIGN KEY (id_referenced_assembly) REFERENCES assemblies (id) ON UPDATE NO ACTION ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE,
CONSTRAINT FK_8C74887E3FFDCD60 FOREIGN KEY (price_currency_id) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE
)
SQL);
$this->addSql(<<<'SQL'
@ -168,9 +166,6 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
$this->addSql(<<<'SQL'
CREATE INDEX IDX_8C74887EC22F6CC4 ON assembly_bom_entries (id_part)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_8C74887EF12E799E ON assembly_bom_entries (id_project)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_8C74887E22522999 ON assembly_bom_entries (id_referenced_assembly)
SQL);
@ -193,19 +188,19 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
{
$this->addSql(<<<'SQL'
CREATE TABLE assemblies (
id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
name VARCHAR(255) NOT NULL,
last_modified TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
comment TEXT NOT NULL,
not_selectable BOOLEAN NOT NULL,
alternative_names TEXT DEFAULT NULL,
order_quantity INT NOT NULL,
status VARCHAR(64) DEFAULT NULL,
order_only_missing_parts BOOLEAN NOT NULL,
description TEXT NOT NULL,
parent_id INT DEFAULT NULL,
id_preview_attachment INT DEFAULT NULL,
id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
name VARCHAR(255) NOT NULL,
last_modified TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
comment TEXT NOT NULL,
not_selectable BOOLEAN NOT NULL,
alternative_names TEXT DEFAULT NULL,
order_quantity INT NOT NULL,
status VARCHAR(64) DEFAULT NULL,
order_only_missing_parts BOOLEAN NOT NULL,
description TEXT NOT NULL,
parent_id INT DEFAULT NULL,
id_preview_attachment INT DEFAULT NULL,
PRIMARY KEY(id)
)
SQL);
@ -217,18 +212,17 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE assembly_bom_entries (
id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
id_assembly INT DEFAULT NULL,
id_part INT DEFAULT NULL,
id_project INT DEFAULT NULL,
quantity DOUBLE PRECISION NOT NULL,
mountnames TEXT NOT NULL,
name VARCHAR(255) DEFAULT NULL,
comment TEXT NOT NULL,
price NUMERIC(11, 5) DEFAULT NULL,
id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
id_assembly INT DEFAULT NULL,
id_part INT DEFAULT NULL,
quantity DOUBLE PRECISION NOT NULL,
mountnames TEXT NOT NULL,
name VARCHAR(255) DEFAULT NULL,
comment TEXT NOT NULL,
price NUMERIC(11, 5) DEFAULT NULL,
price_currency_id INT DEFAULT NULL,
last_modified TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
last_modified TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
datetime_added TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY(id)
)
SQL);
@ -238,9 +232,6 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
$this->addSql(<<<'SQL'
CREATE INDEX IDX_8C74887EC22F6CC4 ON assembly_bom_entries (id_part)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_8C74887EF12E799E ON assembly_bom_entries (id_project)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_8C74887E3FFDCD60 ON assembly_bom_entries (price_currency_id)
SQL);
@ -256,9 +247,6 @@ final class Version20250304081039 extends AbstractMultiPlatformMigration
$this->addSql(<<<'SQL'
ALTER TABLE assembly_bom_entries ADD CONSTRAINT FK_8C74887EC22F6CC4 FOREIGN KEY (id_part) REFERENCES "parts" (id) NOT DEFERRABLE INITIALLY IMMEDIATE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE assembly_bom_entries ADD CONSTRAINT FK_8C74887EF12E799E FOREIGN KEY (id_project) REFERENCES "projects" (id) NOT DEFERRABLE INITIALLY IMMEDIATE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE assembly_bom_entries ADD CONSTRAINT FK_8C74887E3FFDCD60 FOREIGN KEY (price_currency_id) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE
SQL);

View file

@ -17,7 +17,7 @@ final class Version20250627130848 extends AbstractMultiPlatformMigration
public function mySQLUp(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE assembly_bom_entries ADD id_referenced_assembly INT DEFAULT NULL AFTER id_project
ALTER TABLE assembly_bom_entries ADD id_referenced_assembly INT DEFAULT NULL AFTER id_part
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE assembly_bom_entries ADD CONSTRAINT FK_8C74887E22522999 FOREIGN KEY (id_referenced_assembly) REFERENCES assemblies (id) ON DELETE SET NULL

View file

@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Migration\AbstractMultiPlatformMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250910113423 extends AbstractMultiPlatformMigration
{
public function getDescription(): string
{
return 'Remove project_id from assembly_bom_entries because it is not needed.';
}
public function mySQLUp(Schema $schema): void
{
$this->addSql('ALTER TABLE assembly_bom_entries DROP FOREIGN KEY `FK_8C74887EF12E799E`');
$this->addSql('DROP INDEX IDX_8C74887EF12E799E ON assembly_bom_entries');
$this->addSql('ALTER TABLE assembly_bom_entries DROP id_project');
}
public function mySQLDown(Schema $schema): void
{
$this->addSql('ALTER TABLE assembly_bom_entries ADD id_project INT DEFAULT NULL');
$this->addSql('ALTER TABLE assembly_bom_entries ADD CONSTRAINT `FK_8C74887EF12E799E` FOREIGN KEY (id_project) REFERENCES projects (id)');
$this->addSql('CREATE INDEX IDX_8C74887EF12E799E ON assembly_bom_entries (id_project)');
}
public function sqLiteUp(Schema $schema): void
{
//nothing to do. Already removed from AssemblyBOMEntry and Version20250304081039
}
public function sqLiteDown(Schema $schema): void
{
//nothing to do.
}
public function postgreSQLUp(Schema $schema): void
{
//nothing to do. Already removed from AssemblyBOMEntry and Version20250304081039
}
public function postgreSQLDown(Schema $schema): void
{
//nothing to do.
}
}