Adds five requires_* Booleans on fusion.plating.process.node (requires_coc, requires_thickness_report, requires_nadcap_cert, requires_mill_test, requires_customer_specific), default True. Recipe is SUPPRESS-ONLY: when False, the recipe never produces that cert type even if the customer/part requested it. Default True = existing recipes keep producing the same cert set they produce today. Surfaced on recipe-level form (node_type == 'recipe'); resolver reads from job.recipe_id which is always a top-level recipe node. Post-migrate backfills NULL -> TRUE on existing nodes. Sub: docs/superpowers/specs/2026-05-27-recipe-cert-toggles-design.md Task: T2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2026 Nexa Systems Inc.
|
|
# License OPL-1
|
|
"""Post-migrate for 19.0.22.0.0 — Recipe-level cert suppression Booleans.
|
|
|
|
Backfills NULL -> TRUE on the five new requires_* columns on
|
|
fusion.plating.process.node (requires_coc, requires_thickness_report,
|
|
requires_nadcap_cert, requires_mill_test, requires_customer_specific).
|
|
|
|
Default TRUE = inherit current behaviour for every existing recipe
|
|
(zero migration surprises — every existing recipe keeps producing
|
|
the same cert set it produces today).
|
|
|
|
Idempotent: safe to re-run.
|
|
|
|
Spec: docs/superpowers/specs/2026-05-27-recipe-cert-toggles-design.md
|
|
"""
|
|
import logging
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
def migrate(cr, version):
|
|
if not version:
|
|
return
|
|
_logger.info(
|
|
'19.0.22.0.0 post-migrate: backfilling recipe cert-suppression '
|
|
'requires_* Booleans to TRUE on fusion.plating.process.node rows'
|
|
)
|
|
for col in (
|
|
'requires_coc',
|
|
'requires_thickness_report',
|
|
'requires_nadcap_cert',
|
|
'requires_mill_test',
|
|
'requires_customer_specific',
|
|
):
|
|
cr.execute(
|
|
"UPDATE fusion_plating_process_node SET %s = TRUE "
|
|
"WHERE %s IS NULL" % (col, col)
|
|
)
|
|
_logger.info(' %s: %d rows updated', col, cr.rowcount)
|