From 5336dfc09d498e017cf79ce02c34a31e68bd8ead Mon Sep 17 00:00:00 2001 From: Matthieu Date: Thu, 12 Mar 2026 18:11:14 +0100 Subject: [PATCH] feat(skeleton) : drop skeleton JSON columns from model_types Co-Authored-By: Claude Opus 4.6 --- Inventory_frontend | 2 +- migrations/Version20260312180000.php | 35 +++++++++ src/Entity/ModelType.php | 71 ------------------- .../ModelTypeCategoryConversionService.php | 4 -- 4 files changed, 36 insertions(+), 76 deletions(-) create mode 100644 migrations/Version20260312180000.php diff --git a/Inventory_frontend b/Inventory_frontend index 4a3bcef..9fef009 160000 --- a/Inventory_frontend +++ b/Inventory_frontend @@ -1 +1 @@ -Subproject commit 4a3bceffa18fcbd7b79fd13e9c5477f115f9a9b6 +Subproject commit 9fef009610decc8a90931019c2671c7c1eb757c3 diff --git a/migrations/Version20260312180000.php b/migrations/Version20260312180000.php new file mode 100644 index 0000000..08f9fb3 --- /dev/null +++ b/migrations/Version20260312180000.php @@ -0,0 +1,35 @@ +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'); + } +} diff --git a/src/Entity/ModelType.php b/src/Entity/ModelType.php index 239ed30..c42458f 100644 --- a/src/Entity/ModelType.php +++ b/src/Entity/ModelType.php @@ -73,18 +73,6 @@ class ModelType #[Groups(['type_machine:read', 'model_type:read', 'model_type:write'])] 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')] #[Groups(['model_type:read'])] private DateTimeImmutable $createdAt; @@ -227,42 +215,6 @@ class ModelType 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'])] public function getStructure(): ?array { @@ -428,27 +380,4 @@ class ModelType ], $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; - } } diff --git a/src/Service/ModelTypeCategoryConversionService.php b/src/Service/ModelTypeCategoryConversionService.php index 8c8a372..10cb61e 100644 --- a/src/Service/ModelTypeCategoryConversionService.php +++ b/src/Service/ModelTypeCategoryConversionService.php @@ -325,8 +325,6 @@ final class ModelTypeCategoryConversionService $this->connection->executeStatement( 'UPDATE model_types SET category = :cat, - componentskeleton = pieceskeleton, - pieceskeleton = NULL, updatedat = :now WHERE id = :id', [ @@ -395,8 +393,6 @@ final class ModelTypeCategoryConversionService $this->connection->executeStatement( 'UPDATE model_types SET category = :cat, - pieceskeleton = componentskeleton, - componentskeleton = NULL, updatedat = :now WHERE id = :id', [