mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[ADD] runbot_merge: missing staging migration
44084e303c
changed the interpretation
and schema of the `statuses_cache` field on stagings, but I forgot to
add a migration, so it would just blow up on opening the home
dashboard or the staging lists.
This commit is contained in:
parent
f4035932e3
commit
2fb85c515e
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
'name': 'merge bot',
|
'name': 'merge bot',
|
||||||
'version': '1.14',
|
'version': '1.15',
|
||||||
'depends': ['contacts', 'mail', 'website'],
|
'depends': ['contacts', 'mail', 'website'],
|
||||||
'data': [
|
'data': [
|
||||||
'security/security.xml',
|
'security/security.xml',
|
||||||
|
22
runbot_merge/migrations/15.0.1.15/pre-migration.py
Normal file
22
runbot_merge/migrations/15.0.1.15/pre-migration.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
"""Completely missed that in 44084e303ccece3cb54128ab29eab399bd4d24e9 I
|
||||||
|
completely changed the semantics and structure of the statuses_cache, so the
|
||||||
|
old caches don't actually work anymore at all.
|
||||||
|
|
||||||
|
This rewrites all existing caches.
|
||||||
|
"""
|
||||||
|
def migrate(cr, version):
|
||||||
|
cr.execute("""
|
||||||
|
WITH statuses AS (
|
||||||
|
SELECT
|
||||||
|
s.id as staging_id,
|
||||||
|
json_object_agg(c.sha, c.statuses::json) as statuses
|
||||||
|
FROM runbot_merge_stagings s
|
||||||
|
LEFT JOIN runbot_merge_stagings_heads h ON (h.staging_id = s.id)
|
||||||
|
LEFT JOIN runbot_merge_commit c ON (h.commit_id = c.id)
|
||||||
|
GROUP BY s.id
|
||||||
|
)
|
||||||
|
UPDATE runbot_merge_stagings
|
||||||
|
SET statuses_cache = statuses
|
||||||
|
FROM statuses
|
||||||
|
WHERE id = staging_id
|
||||||
|
""")
|
Loading…
Reference in New Issue
Block a user