Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules180-190.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Module coverage 18.0 -> 19.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| http_routing |Nothing to do | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| iap | |No DB layout changes. |
| iap |Done |Backfill service_id from legacy service_name. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| iap_crm | |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
36 changes: 36 additions & 0 deletions openupgrade_scripts/scripts/iap/19.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2026 Ledo
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
# The legacy column was named when an earlier major-version migration
# preserved iap_account.service_name; depending on the DB's history the
# prefix can be openupgrade_legacy_<N>_0_*. Look it up dynamically.
env.cr.execute(
"""
SELECT column_name
FROM information_schema.columns
WHERE table_name = 'iap_account'
AND column_name LIKE 'openupgrade_legacy_%_service_name'
ORDER BY column_name
LIMIT 1
"""
)
row = env.cr.fetchone()
if not row:
return
legacy_col = row[0]
openupgrade.logged_query(
env.cr,
"""
UPDATE iap_account a
SET service_id = s.id
FROM iap_service s
WHERE a.service_id IS NULL
AND a.%s = s.technical_name
"""
% legacy_col,
)
Loading