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],
|
||||
);
|
||||
|
||||
// 2. Transfer constructeur associations
|
||||
// 2. Transfer constructeur link associations
|
||||
$this->connection->executeStatement(
|
||||
'INSERT INTO _composantconstructeurs (a, b)
|
||||
SELECT pc.a, pc.b FROM _piececonstructeurs pc
|
||||
WHERE pc.a IN (SELECT id FROM composants WHERE typecomposantid = :id)',
|
||||
"INSERT INTO composant_constructeur_links (id, composantid, constructeurid, supplierreference, createdat, updatedat)
|
||||
SELECT 'cl' || substring(md5(random()::text || clock_timestamp()::text), 1, 24), pcl.pieceid, pcl.constructeurid, pcl.supplierreference, pcl.createdat, pcl.updatedat
|
||||
FROM piece_constructeur_links pcl
|
||||
WHERE pcl.pieceid IN (SELECT id FROM composants WHERE typecomposantid = :id)",
|
||||
['id' => $modelTypeId],
|
||||
);
|
||||
|
||||
$this->connection->executeStatement(
|
||||
'DELETE FROM _piececonstructeurs
|
||||
WHERE a IN (SELECT id FROM pieces WHERE typepieceid = :id)',
|
||||
'DELETE FROM piece_constructeur_links
|
||||
WHERE pieceid IN (SELECT id FROM pieces WHERE typepieceid = :id)',
|
||||
['id' => $modelTypeId],
|
||||
);
|
||||
|
||||
@@ -352,17 +353,18 @@ final class ModelTypeCategoryConversionService
|
||||
['id' => $modelTypeId],
|
||||
);
|
||||
|
||||
// 2. Transfer constructeur associations
|
||||
// 2. Transfer constructeur link associations
|
||||
$this->connection->executeStatement(
|
||||
'INSERT INTO _piececonstructeurs (a, b)
|
||||
SELECT cc.a, cc.b FROM _composantconstructeurs cc
|
||||
WHERE cc.a IN (SELECT id FROM pieces WHERE typepieceid = :id)',
|
||||
"INSERT INTO piece_constructeur_links (id, pieceid, constructeurid, supplierreference, createdat, updatedat)
|
||||
SELECT 'cl' || substring(md5(random()::text || clock_timestamp()::text), 1, 24), ccl.composantid, ccl.constructeurid, ccl.supplierreference, ccl.createdat, ccl.updatedat
|
||||
FROM composant_constructeur_links ccl
|
||||
WHERE ccl.composantid IN (SELECT id FROM pieces WHERE typepieceid = :id)",
|
||||
['id' => $modelTypeId],
|
||||
);
|
||||
|
||||
$this->connection->executeStatement(
|
||||
'DELETE FROM _composantconstructeurs
|
||||
WHERE a IN (SELECT id FROM composants WHERE typecomposantid = :id)',
|
||||
'DELETE FROM composant_constructeur_links
|
||||
WHERE composantid IN (SELECT id FROM composants WHERE typecomposantid = :id)',
|
||||
['id' => $modelTypeId],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user