fix : code review — correct 15 issues across UX overhaul (phases 1-4)
Critical fixes: - Make MigrateConstructeurLinks migration no-op (legacy tables already dropped) - Add explicit ON CONFLICT (id) target in RestoreConstructeurLinks migration - Replace N+1 queries with 4 bulk GROUP BY in ConstructeurStatsController - Declare missing versionListRef template ref in machine detail page - Add missing await on removeMachineDocument, cast activeTab as string Important fixes: - Add lang="ts" to ToastContainer and constructeurs page - Type entityType as union in UsedInSection/useUsedIn - Remove dead duration param from showError - Update back-link props to new /catalogues/* URLs (3 pages) - Replace raw error blocks with EmptyState in component/piece detail pages - Type handleFillEntity params and machineInfoCardRef Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,69 +21,13 @@ final class Version20260405_MigrateConstructeurLinks extends AbstractMigration
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// Composant links (a = composantId, b = constructeurId)
|
||||
$this->addSql("
|
||||
INSERT INTO composant_constructeur_links (id, composantid, constructeurid, supplierreference, createdat, updatedat)
|
||||
SELECT
|
||||
'clmig_cc_' || ROW_NUMBER() OVER (ORDER BY a, b),
|
||||
a, b, NULL, NOW(), NOW()
|
||||
FROM _composantconstructeurs
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM composant_constructeur_links
|
||||
WHERE composantid = _composantconstructeurs.a
|
||||
AND constructeurid = _composantconstructeurs.b
|
||||
)
|
||||
");
|
||||
|
||||
// Piece links
|
||||
$this->addSql("
|
||||
INSERT INTO piece_constructeur_links (id, pieceid, constructeurid, supplierreference, createdat, updatedat)
|
||||
SELECT
|
||||
'clmig_pc_' || ROW_NUMBER() OVER (ORDER BY a, b),
|
||||
a, b, NULL, NOW(), NOW()
|
||||
FROM _piececonstructeurs
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM piece_constructeur_links
|
||||
WHERE pieceid = _piececonstructeurs.a
|
||||
AND constructeurid = _piececonstructeurs.b
|
||||
)
|
||||
");
|
||||
|
||||
// Machine links
|
||||
$this->addSql("
|
||||
INSERT INTO machine_constructeur_links (id, machineid, constructeurid, supplierreference, createdat, updatedat)
|
||||
SELECT
|
||||
'clmig_mc_' || ROW_NUMBER() OVER (ORDER BY a, b),
|
||||
a, b, NULL, NOW(), NOW()
|
||||
FROM _machineconstructeurs
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM machine_constructeur_links
|
||||
WHERE machineid = _machineconstructeurs.a
|
||||
AND constructeurid = _machineconstructeurs.b
|
||||
)
|
||||
");
|
||||
|
||||
// Product links
|
||||
$this->addSql("
|
||||
INSERT INTO product_constructeur_links (id, productid, constructeurid, supplierreference, createdat, updatedat)
|
||||
SELECT
|
||||
'clmig_prc_' || ROW_NUMBER() OVER (ORDER BY a, b),
|
||||
a, b, NULL, NOW(), NOW()
|
||||
FROM _productconstructeurs
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM product_constructeur_links
|
||||
WHERE productid = _productconstructeurs.a
|
||||
AND constructeurid = _productconstructeurs.b
|
||||
)
|
||||
");
|
||||
// No-op: legacy M2M tables (_composantconstructeurs, _piececonstructeurs, etc.)
|
||||
// were already dropped by Version20260331121257.
|
||||
// The actual data restoration is handled by Version20260405_RestoreConstructeurLinksFromBackup.
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// Remove only the migrated rows (identifiable by 'clmig_' prefix)
|
||||
$this->addSql("DELETE FROM composant_constructeur_links WHERE id LIKE 'clmig_cc_%'");
|
||||
$this->addSql("DELETE FROM piece_constructeur_links WHERE id LIKE 'clmig_pc_%'");
|
||||
$this->addSql("DELETE FROM machine_constructeur_links WHERE id LIKE 'clmig_mc_%'");
|
||||
$this->addSql("DELETE FROM product_constructeur_links WHERE id LIKE 'clmig_prc_%'");
|
||||
// No-op
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user