mirror of
https://github.com/odoo/runbot.git
synced 2025-03-16 07:55:45 +07:00
[IMP] runbot: increase version and add migration scripts
Migration scripts from runbot 3.1 to runbot 4.0.
This commit is contained in:
parent
8ef6bcfde7
commit
3aabfd4bd3
@ -6,7 +6,7 @@
|
||||
'author': "Odoo SA",
|
||||
'website': "http://runbot.odoo.com",
|
||||
'category': 'Website',
|
||||
'version': '3.1',
|
||||
'version': '4.0',
|
||||
'depends': ['website', 'base'],
|
||||
'data': [
|
||||
'security/runbot_security.xml',
|
||||
|
27
runbot/migrations/4.0/post-migration.py
Normal file
27
runbot/migrations/4.0/post-migration.py
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
|
||||
def ref(xmlid):
|
||||
cr.execute("SELECT res_id FROM ir_model_data WHERE module=%s AND name=%s", xmlid.split('.'))
|
||||
return cr.fetchone()
|
||||
|
||||
# fill config_id Many2one with the default config
|
||||
cr.execute('UPDATE runbot_build SET config_id = %s', ref('runbot.runbot_build_config_default'))
|
||||
cr.execute('ALTER TABLE runbot_build ALTER COLUMN config_id SET NOT NULL')
|
||||
cr.execute("UPDATE runbot_repo SET repo_config_id = %s", ref('runbot.runbot_build_config_default'))
|
||||
cr.execute("UPDATE runbot_branch SET branch_config_id = %s WHERE job_type = 'testing'", ref('runbot.runbot_build_config_default_no_run'))
|
||||
|
||||
# set no_build on tmp branches
|
||||
cr.execute("UPDATE runbot_branch SET no_build = 't' WHERE job_type = 'none'")
|
||||
|
||||
# set config to Default_no_ run when branch is testing
|
||||
cr.execute("UPDATE runbot_branch SET branch_config_id = %s WHERE job_type = 'testing'" % ref('runbot.runbot_build_config_default_no_run'))
|
||||
|
||||
# set build_start/_end
|
||||
cr.execute("UPDATE runbot_build SET build_start = job_start")
|
||||
cr.execute("UPDATE runbot_build SET build_end = job_end")
|
||||
|
||||
# set cron minutes to seconds and multiply by 10
|
||||
cr.execute("UPDATE ir_cron SET interval_type='seconds', interval_number=interval_number*10 WHERE interval_type='minutes'")
|
38
runbot/migrations/4.0/pre-migration.py
Normal file
38
runbot/migrations/4.0/pre-migration.py
Normal file
@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
# delete oldies
|
||||
old_models = tuple([
|
||||
'ir.qweb.widget', 'ir.qweb.widget.monetary', 'base.module.import',
|
||||
'res.currency.rate.type', 'website.converter.test.sub',
|
||||
'website.converter.test', 'runbot.config.settings',
|
||||
'report.abstract_report', 'base.action.rule.lead.test',
|
||||
'base.action.rule.line.test'
|
||||
])
|
||||
cr.execute("DELETE FROM ir_model WHERE model IN %s", [old_models])
|
||||
|
||||
# pre-create the log_list column
|
||||
cr.execute("ALTER TABLE runbot_build ADD COLUMN log_list character varying")
|
||||
cr.execute("UPDATE runbot_build SET log_list='base,all,run' WHERE job_type = 'all' or job_type is null")
|
||||
cr.execute("UPDATE runbot_build SET log_list='base,all' WHERE job_type = 'testing'")
|
||||
cr.execute("UPDATE runbot_build SET log_list='all,run' WHERE job_type = 'running'")
|
||||
|
||||
# pre-create config_id column
|
||||
cr.execute('ALTER TABLE runbot_build ADD COLUMN config_id integer')
|
||||
|
||||
# pre-fill global result column for old builds
|
||||
cr.execute("ALTER TABLE runbot_build ADD COLUMN global_result character varying")
|
||||
cr.execute("ALTER TABLE runbot_build ADD COLUMN global_state character varying")
|
||||
cr.execute("UPDATE runbot_build SET global_result=result, global_state=state WHERE duplicate_id is null")
|
||||
|
||||
# set correct values on duplicates too
|
||||
cr.execute("UPDATE runbot_build AS updated_build SET global_result = fb.global_result, global_state = fb.global_state FROM runbot_build AS fb WHERE updated_build.duplicate_id = fb.id")
|
||||
|
||||
# pre-fill nb_ fields to avoid a huge recompute
|
||||
cr.execute("ALTER TABLE runbot_build ADD COLUMN nb_pending INTEGER DEFAULT 0")
|
||||
cr.execute("ALTER TABLE runbot_build ADD COLUMN nb_testing INTEGER DEFAULT 0")
|
||||
cr.execute("ALTER TABLE runbot_build ADD COLUMN nb_running INTEGER DEFAULT 0")
|
||||
cr.execute("ALTER TABLE runbot_build ALTER COLUMN nb_pending DROP DEFAULT")
|
||||
cr.execute("ALTER TABLE runbot_build ALTER COLUMN nb_testing DROP DEFAULT")
|
||||
cr.execute("ALTER TABLE runbot_build ALTER COLUMN nb_running DROP DEFAULT")
|
Loading…
Reference in New Issue
Block a user