refactor(conversion) : update category conversion to use ConstructeurLink tables
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -284,17 +284,18 @@ final class ModelTypeCategoryConversionService
|
|||||||
['id' => $modelTypeId],
|
['id' => $modelTypeId],
|
||||||
);
|
);
|
||||||
|
|
||||||
// 2. Transfer constructeur associations
|
// 2. Transfer constructeur link associations
|
||||||
$this->connection->executeStatement(
|
$this->connection->executeStatement(
|
||||||
'INSERT INTO _composantconstructeurs (a, b)
|
"INSERT INTO composant_constructeur_links (id, composantid, constructeurid, supplierreference, createdat, updatedat)
|
||||||
SELECT pc.a, pc.b FROM _piececonstructeurs pc
|
SELECT 'cl' || substring(md5(random()::text || clock_timestamp()::text), 1, 24), pcl.pieceid, pcl.constructeurid, pcl.supplierreference, pcl.createdat, pcl.updatedat
|
||||||
WHERE pc.a IN (SELECT id FROM composants WHERE typecomposantid = :id)',
|
FROM piece_constructeur_links pcl
|
||||||
|
WHERE pcl.pieceid IN (SELECT id FROM composants WHERE typecomposantid = :id)",
|
||||||
['id' => $modelTypeId],
|
['id' => $modelTypeId],
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->connection->executeStatement(
|
$this->connection->executeStatement(
|
||||||
'DELETE FROM _piececonstructeurs
|
'DELETE FROM piece_constructeur_links
|
||||||
WHERE a IN (SELECT id FROM pieces WHERE typepieceid = :id)',
|
WHERE pieceid IN (SELECT id FROM pieces WHERE typepieceid = :id)',
|
||||||
['id' => $modelTypeId],
|
['id' => $modelTypeId],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -352,17 +353,18 @@ final class ModelTypeCategoryConversionService
|
|||||||
['id' => $modelTypeId],
|
['id' => $modelTypeId],
|
||||||
);
|
);
|
||||||
|
|
||||||
// 2. Transfer constructeur associations
|
// 2. Transfer constructeur link associations
|
||||||
$this->connection->executeStatement(
|
$this->connection->executeStatement(
|
||||||
'INSERT INTO _piececonstructeurs (a, b)
|
"INSERT INTO piece_constructeur_links (id, pieceid, constructeurid, supplierreference, createdat, updatedat)
|
||||||
SELECT cc.a, cc.b FROM _composantconstructeurs cc
|
SELECT 'cl' || substring(md5(random()::text || clock_timestamp()::text), 1, 24), ccl.composantid, ccl.constructeurid, ccl.supplierreference, ccl.createdat, ccl.updatedat
|
||||||
WHERE cc.a IN (SELECT id FROM pieces WHERE typepieceid = :id)',
|
FROM composant_constructeur_links ccl
|
||||||
|
WHERE ccl.composantid IN (SELECT id FROM pieces WHERE typepieceid = :id)",
|
||||||
['id' => $modelTypeId],
|
['id' => $modelTypeId],
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->connection->executeStatement(
|
$this->connection->executeStatement(
|
||||||
'DELETE FROM _composantconstructeurs
|
'DELETE FROM composant_constructeur_links
|
||||||
WHERE a IN (SELECT id FROM composants WHERE typecomposantid = :id)',
|
WHERE composantid IN (SELECT id FROM composants WHERE typecomposantid = :id)',
|
||||||
['id' => $modelTypeId],
|
['id' => $modelTypeId],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user