runbot/forwardport/migrations/15.0.1.2/pre-migration.py
Xavier Morel ef52785d82 [IMP] forwardport: store and display detachment reason
Currently, if a PR forward-port PR gets detached the reason for it is
not always obvious, and may have to be hunted in the logs or in
"sibling" PRs.

By writing a forward port reason (hopefully) ever time we detach a PR,
and displaying that reason in the form and dashboard, the
justification should be a lot more obvious.

Fixes #679
2023-01-19 14:23:41 +01:00

12 lines
363 B
Python

def migrate(cr, version):
""" Add a dummy detach reason to detached PRs.
"""
cr.execute(
"ALTER TABLE runbot_merge_pull_requests"
" ADD COLUMN detach_reason varchar"
)
cr.execute(
"UPDATE runbot_merge_pull_requests"
" SET detach_reason = 'unknown'"
" WHERE source_id IS NOT NULL AND parent_id IS NULL")