migration/0.2.0_Any.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 20 Oct 2009 13:57:47 +0200
branchstable
changeset 309 dec84f991c96
parent 112 c12b99330b00
permissions -rw-r--r--
migration script

add_entity('CWGroup', name=_('apycot'))
add_entity('CWUser', login=_('apycotbot'), upassword='apycot')
rql('SET U in_group G WHERE U login "apycotbot", G name "apycot"')
rql('SET U in_group G WHERE U login "apycotbot", G name "guests"')

add_entity_type('ApycotConfigGroup')

add_relation_definition('ProjectApycotConfig', 'in_state', 'State')
add_relation_definition('TrInfo', 'wf_info_for', 'ProjectApycotConfig')

for etype in ('ProjectApycotConfig',
              'ApycotExecution', 'CheckResult',
              'CheckResultLog', 'CheckResultInfo'):
    synchronize_eschema(etype)
for rtype in ('has_apycot_config', 'for_check', 'using_config', 'during_execution'):
    if rtype in schema:
        synchronize_rschema(rtype)


activatedeid = add_state(_('activated'), 'ProjectApycotConfig', initial=True)
deactivatedeid = add_state(_('deactivated'), 'ProjectApycotConfig')
add_transition(_('deactivate'), 'ProjectApycotConfig',
               (activatedeid,), deactivatedeid,
               requiredgroups=('managers',))
add_transition(_('activate'), 'ProjectApycotConfig',
               (deactivatedeid,), activatedeid,
               requiredgroups=('managers',))
checkpoint()

rql('SET X in_state S WHERE X is ProjectApycotConfig, S name "activated", S state_of ET, X is ET')
checkpoint()