[OU-ADD] iap: backfill service_id from legacy service_name#37
Draft
dnplkndll wants to merge 1 commit into
Draft
Conversation
Adds openupgrade_scripts/scripts/iap/19.0.1.1/post-migration.py to map the openupgrade_legacy_18_0_service_name column onto iap_account.service_id for rows left half-migrated by an earlier major-version upgrade. DBs in this shape have rows where service_id IS NULL despite 19.0's required=True declaration, producing a "Missing not-null constraint on iap.account.service_id" warning at schema sync. The backfill resolves those rows by matching the preserved legacy service_name against iap_service.technical_name. Marks the iap row in docsource/modules180-190.rst as Done.
212e9f0 to
1f8b453
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this scope covers
Adds
openupgrade_scripts/scripts/iap/19.0.1.1/post-migration.pyto backfilliap_account.service_idfrom the preserved legacyservice_namecolumn for rows that an earlier major-version migration left in a half-migrated state.Why
Surfaced in lab
make migrateagainst our prod-seed via:The 18.0 and 19.0 ORM definitions of
iap.accountare actually identical (service_id = Many2one(required=True),service_name = Char(related=...)). The mismatch comes from earlier — theopenupgrade_legacy_18_0_service_namecolumn on our seed shows the rename happened in 17→18 — and one stale row from 2020 never received aservice_idvalue. 19.0's_auto_initthen tries to add NOT NULL and warns when the orphan blocks it.Any DB carrying that same shape (legacy_service_name preserved, service_id NULL) hits the same warning. The backfill defensively maps both.
What's in the patch
openupgrade_scripts/scripts/iap/19.0.1.1/post-migration.py— a singleUPDATE … FROM iap_servicestatement that joins ontechnical_nameviaopenupgrade.get_legacy_name("service_name").docsource/modules180-190.rst— sets theiaprow toDoneso the test workflow picks it up.No
upgrade_analysis_work.txt(precedent:barcodes_gs1_nomenclature/19.0.1.0,digest/19.0.1.1,pos_discount/19.0.1.0all shippost-migration.pywithout a work file when the analysis bot didn't generate a delta).Reproducing
The analysis bot doesn't flag this — the gap is invisible at the ORM-definition level and only surfaces when a real seed carries orphan rows. To reproduce the warning before the patch:
A
null_rows > 0count indicates the same shape as our seed.How to verify
After this branch lands in
repos.yamlandmake sync-repos: