mirror of
https://github.com/odoo/runbot.git
synced 2025-03-17 00:15:47 +07:00

Moving statuses from project to repo was originally developed on 11, but since the PR was only merged after the 13.0 update, the script migration script should be moved to match.
18 lines
651 B
Python
18 lines
651 B
Python
def migrate(cr, version):
|
|
""" Moved the required_statuses field from the project to the repository so
|
|
different repos can have different CI requirements within a project
|
|
"""
|
|
# create column on repo
|
|
cr.execute("ALTER TABLE runbot_merge_repository ADD COLUMN required_statuses varchar")
|
|
# copy data from project
|
|
cr.execute("""
|
|
UPDATE runbot_merge_repository r
|
|
SET required_statuses = (
|
|
SELECT required_statuses
|
|
FROM runbot_merge_project
|
|
WHERE id = r.project_id
|
|
)
|
|
""")
|
|
# drop old column on project
|
|
cr.execute("ALTER TABLE runbot_merge_project DROP COLUMN required_statuses")
|