misc/migration/bootstrapmigration_repository.py
branchstable
changeset 6222 21772f4e41d9
parent 6208 07b176640a8c
child 6896 784d5df35af1
equal deleted inserted replaced
6221:a5cc5dc15f9d 6222:21772f4e41d9
    32     rdef.rtype = schema.rschema(rtype)
    32     rdef.rtype = schema.rschema(rtype)
    33     rdef.subject = schema.eschema(subjtype)
    33     rdef.subject = schema.eschema(subjtype)
    34     rdef.object = schema.eschema(objtype)
    34     rdef.object = schema.eschema(objtype)
    35     ss.execschemarql(rql, rdef, ss.rdef2rql(rdef, CSTRMAP, groupmap=None))
    35     ss.execschemarql(rql, rdef, ss.rdef2rql(rdef, CSTRMAP, groupmap=None))
    36     commit(ask_confirm=False)
    36     commit(ask_confirm=False)
    37 
       
    38 if applcubicwebversion < (3, 9, 6) and cubicwebversion >= (3, 9, 6):
       
    39     add_entity_type('CWUniqueTogetherConstraint')
       
    40 
    37 
    41 if applcubicwebversion == (3, 6, 0) and cubicwebversion >= (3, 6, 0):
    38 if applcubicwebversion == (3, 6, 0) and cubicwebversion >= (3, 6, 0):
    42     CSTRMAP = dict(rql('Any T, X WHERE X is CWConstraintType, X name T',
    39     CSTRMAP = dict(rql('Any T, X WHERE X is CWConstraintType, X name T',
    43                        ask_confirm=False))
    40                        ask_confirm=False))
    44     _add_relation_definition_no_perms('CWAttribute', 'update_permission', 'CWGroup')
    41     _add_relation_definition_no_perms('CWAttribute', 'update_permission', 'CWGroup')
    93             'X relation_type RT, RT add_permission Y2, Y2 exprtype YET, '
    90             'X relation_type RT, RT add_permission Y2, Y2 exprtype YET, '
    94             'Y2 mainvars YMV, Y2 expression YEX')
    91             'Y2 mainvars YMV, Y2 expression YEX')
    95         for action in ('read', 'add', 'delete'):
    92         for action in ('read', 'add', 'delete'):
    96             drop_relation_definition('CWRType', '%s_permission' % action, 'CWGroup', commit=False)
    93             drop_relation_definition('CWRType', '%s_permission' % action, 'CWGroup', commit=False)
    97             drop_relation_definition('CWRType', '%s_permission' % action, 'RQLExpression')
    94             drop_relation_definition('CWRType', '%s_permission' % action, 'RQLExpression')
       
    95     sync_schema_props_perms('read_permission', syncperms=False) # fix read_permission cardinality
       
    96 
       
    97 if applcubicwebversion < (3, 9, 6) and cubicwebversion >= (3, 9, 6):
       
    98     add_entity_type('CWUniqueTogetherConstraint')
    98 
    99 
    99 if applcubicwebversion < (3, 4, 0) and cubicwebversion >= (3, 4, 0):
   100 if applcubicwebversion < (3, 4, 0) and cubicwebversion >= (3, 4, 0):
   100 
   101 
   101     with hooks_control(session, session.HOOKS_ALLOW_ALL, 'integrity'):
   102     with hooks_control(session, session.HOOKS_ALLOW_ALL, 'integrity'):
   102         session.set_shared_data('do-not-insert-cwuri', True)
   103         session.set_shared_data('do-not-insert-cwuri', True)