feat(skeleton) : drop skeleton JSON columns from model_types
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Submodule Inventory_frontend updated: 4a3bceffa1...9fef009610
35
migrations/Version20260312180000.php
Normal file
35
migrations/Version20260312180000.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop skeleton JSON columns from model_types — data now lives in
|
||||||
|
* skeleton_piece_requirements, skeleton_product_requirements,
|
||||||
|
* skeleton_subcomponent_requirements and custom_fields tables.
|
||||||
|
*/
|
||||||
|
final class Version20260312180000 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Drop componentSkeleton, pieceSkeleton, productSkeleton JSON columns from model_types';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE model_types DROP COLUMN IF EXISTS componentskeleton');
|
||||||
|
$this->addSql('ALTER TABLE model_types DROP COLUMN IF EXISTS pieceskeleton');
|
||||||
|
$this->addSql('ALTER TABLE model_types DROP COLUMN IF EXISTS productskeleton');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE model_types ADD COLUMN IF NOT EXISTS componentskeleton JSON DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE model_types ADD COLUMN IF NOT EXISTS pieceskeleton JSON DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE model_types ADD COLUMN IF NOT EXISTS productskeleton JSON DEFAULT NULL');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -73,18 +73,6 @@ class ModelType
|
|||||||
#[Groups(['type_machine:read', 'model_type:read', 'model_type:write'])]
|
#[Groups(['type_machine:read', 'model_type:read', 'model_type:write'])]
|
||||||
private ?string $description = null;
|
private ?string $description = null;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::JSON, nullable: true, name: 'componentSkeleton')]
|
|
||||||
#[Groups(['model_type:read', 'composant:read'])]
|
|
||||||
private ?array $componentSkeleton = null;
|
|
||||||
|
|
||||||
#[ORM\Column(type: Types::JSON, nullable: true, name: 'pieceSkeleton')]
|
|
||||||
#[Groups(['model_type:read', 'piece:read'])]
|
|
||||||
private ?array $pieceSkeleton = null;
|
|
||||||
|
|
||||||
#[ORM\Column(type: Types::JSON, nullable: true, name: 'productSkeleton')]
|
|
||||||
#[Groups(['model_type:read', 'product:read'])]
|
|
||||||
private ?array $productSkeleton = null;
|
|
||||||
|
|
||||||
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'createdAt')]
|
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'createdAt')]
|
||||||
#[Groups(['model_type:read'])]
|
#[Groups(['model_type:read'])]
|
||||||
private DateTimeImmutable $createdAt;
|
private DateTimeImmutable $createdAt;
|
||||||
@@ -227,42 +215,6 @@ class ModelType
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getComponentSkeleton(): ?array
|
|
||||||
{
|
|
||||||
return $this->componentSkeleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setComponentSkeleton(?array $componentSkeleton): static
|
|
||||||
{
|
|
||||||
$this->componentSkeleton = $componentSkeleton;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPieceSkeleton(): ?array
|
|
||||||
{
|
|
||||||
return $this->pieceSkeleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setPieceSkeleton(?array $pieceSkeleton): static
|
|
||||||
{
|
|
||||||
$this->pieceSkeleton = $pieceSkeleton;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getProductSkeleton(): ?array
|
|
||||||
{
|
|
||||||
return $this->productSkeleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setProductSkeleton(?array $productSkeleton): static
|
|
||||||
{
|
|
||||||
$this->productSkeleton = $productSkeleton;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[Groups(['model_type:read', 'product:read', 'composant:read', 'piece:read'])]
|
#[Groups(['model_type:read', 'product:read', 'composant:read', 'piece:read'])]
|
||||||
public function getStructure(): ?array
|
public function getStructure(): ?array
|
||||||
{
|
{
|
||||||
@@ -428,27 +380,4 @@ class ModelType
|
|||||||
], $this->skeletonProductRequirements->toArray()),
|
], $this->skeletonProductRequirements->toArray()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyStructureForCategory(?array $structure, ModelCategory $category): void
|
|
||||||
{
|
|
||||||
if (ModelCategory::COMPONENT === $category) {
|
|
||||||
$this->componentSkeleton = $structure;
|
|
||||||
$this->pieceSkeleton = null;
|
|
||||||
$this->productSkeleton = null;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ModelCategory::PIECE === $category) {
|
|
||||||
$this->pieceSkeleton = $structure;
|
|
||||||
$this->componentSkeleton = null;
|
|
||||||
$this->productSkeleton = null;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->productSkeleton = $structure;
|
|
||||||
$this->componentSkeleton = null;
|
|
||||||
$this->pieceSkeleton = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -325,8 +325,6 @@ final class ModelTypeCategoryConversionService
|
|||||||
$this->connection->executeStatement(
|
$this->connection->executeStatement(
|
||||||
'UPDATE model_types
|
'UPDATE model_types
|
||||||
SET category = :cat,
|
SET category = :cat,
|
||||||
componentskeleton = pieceskeleton,
|
|
||||||
pieceskeleton = NULL,
|
|
||||||
updatedat = :now
|
updatedat = :now
|
||||||
WHERE id = :id',
|
WHERE id = :id',
|
||||||
[
|
[
|
||||||
@@ -395,8 +393,6 @@ final class ModelTypeCategoryConversionService
|
|||||||
$this->connection->executeStatement(
|
$this->connection->executeStatement(
|
||||||
'UPDATE model_types
|
'UPDATE model_types
|
||||||
SET category = :cat,
|
SET category = :cat,
|
||||||
pieceskeleton = componentskeleton,
|
|
||||||
componentskeleton = NULL,
|
|
||||||
updatedat = :now
|
updatedat = :now
|
||||||
WHERE id = :id',
|
WHERE id = :id',
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user