server/test/data/migratedapp/schema.py
author Julien Cristau <julien.cristau@logilab.fr>
Fri, 10 Jan 2014 16:37:12 +0100
changeset 9394 4b89ca0b11ad
parent 9299 c5eed908117d
child 9600 bde625698f44
permissions -rw-r--r--
[server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py Pure reorganization to make it possible to visually compare both schemas.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9394
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
     1
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    10
#
5424
8ecbcbff9777 replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5421
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
6790
f4f67ea5436a [schema migration] add a test to ensure default value are considered
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6292
diff changeset
    18
"""cw.server.migraction test"""
9299
c5eed908117d [schema] store default attribute values in a Bytes field, allowing python objects as default values
Aurélien Campeas <aurelien.campeas@logilab.fr>
parents: 8105
diff changeset
    19
import datetime as dt
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    20
from yams.buildobjs import (EntityType, RelationType, RelationDefinition,
7711
458cb2edf63a [repo test] Fix test broken by BFSSTestable
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 6790
diff changeset
    21
                            SubjectRelation, Bytes,
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    22
                            RichString, String, Int, Boolean, Datetime, Date)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    23
from yams.constraints import SizeConstraint, UniqueConstraint
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    24
from cubicweb.schema import (WorkflowableEntityType, RQLConstraint,
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    25
                             ERQLExpression, RRQLExpression)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    26
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    27
class Affaire(EntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    28
    __permissions__ = {
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    29
        'read':   ('managers', 'users', 'guests'),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    30
        'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    31
        'update': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    32
        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    33
        }
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    34
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    35
    ref = String(fulltextindexed=True, indexed=True,
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    36
                 constraints=[SizeConstraint(16)])
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    37
    sujet = String(fulltextindexed=True,
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    38
                 constraints=[SizeConstraint(256)])
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    39
    concerne = SubjectRelation('Societe')
7711
458cb2edf63a [repo test] Fix test broken by BFSSTestable
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 6790
diff changeset
    40
    opt_attr = Bytes()
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    41
9394
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    42
class Societe(WorkflowableEntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    43
    __permissions__ = {
9394
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    44
        'read': ('managers', 'users', 'guests'),
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    45
        'update': ('managers', 'owners'),
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    46
        'delete': ('managers', 'owners'),
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    47
        'add': ('managers', 'users',)
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    48
        }
9394
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    49
    nom  = String(maxsize=64, fulltextindexed=True)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    50
    web  = String(maxsize=128)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    51
    tel  = Int()
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    52
    fax  = Int()
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    53
    rncs = String(maxsize=128)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    54
    ad1  = String(maxsize=128)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    55
    ad2  = String(maxsize=128)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    56
    ad3  = String(maxsize=128)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    57
    cp   = String(maxsize=12)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    58
    ville= String(maxsize=32)
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    59
9394
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    60
# Division and SubDivision are gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    61
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
    62
# New
2963
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    63
class Para(EntityType):
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    64
    para = String(maxsize=512)
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    65
    newattr = String()
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    66
    newinlined = SubjectRelation('Affaire', cardinality='?*', inlined=True)
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    67
    newnotinlined = SubjectRelation('Affaire', cardinality='?*')
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    68
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    69
class Note(Para):
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    70
    __specializes_schema__ = True
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    71
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    72
    __permissions__ = {'read':   ('managers', 'users', 'guests',),
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    73
                   'update': ('managers', 'owners',),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    74
                   'delete': ('managers', ),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    75
                   'add':    ('managers',
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    76
                              ERQLExpression('X ecrit_part PE, U in_group G, '
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    77
                                             'PE require_permission P, P name "add_note", '
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    78
                                             'P require_group G'),)}
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    79
9299
c5eed908117d [schema] store default attribute values in a Bytes field, allowing python objects as default values
Aurélien Campeas <aurelien.campeas@logilab.fr>
parents: 8105
diff changeset
    80
    whatever = Int(default=0)  # keep it before `date` for unittest_migraction.test_add_attribute_int
c5eed908117d [schema] store default attribute values in a Bytes field, allowing python objects as default values
Aurélien Campeas <aurelien.campeas@logilab.fr>
parents: 8105
diff changeset
    81
    yesno = Boolean(default=False)
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    82
    date = Datetime()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    83
    type = String(maxsize=1)
6292
054fa36060d5 [migractions] add a dropped_constraints() migration command
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 6208
diff changeset
    84
    unique_id = String(maxsize=1, required=True, unique=True)
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    85
    mydate = Date(default='TODAY')
9299
c5eed908117d [schema] store default attribute values in a Bytes field, allowing python objects as default values
Aurélien Campeas <aurelien.campeas@logilab.fr>
parents: 8105
diff changeset
    86
    oldstyledefaultdate = Date(default='2013/01/01')
c5eed908117d [schema] store default attribute values in a Bytes field, allowing python objects as default values
Aurélien Campeas <aurelien.campeas@logilab.fr>
parents: 8105
diff changeset
    87
    newstyledefaultdate = Date(default=dt.date(2013, 1, 1))
6790
f4f67ea5436a [schema migration] add a test to ensure default value are considered
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6292
diff changeset
    88
    shortpara = String(maxsize=64, default='hop')
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    89
    ecrit_par = SubjectRelation('Personne', constraints=[RQLConstraint('S concerne A, O concerne A')])
5575
8a531340c3ef no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5426
diff changeset
    90
    attachment = SubjectRelation('File')
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    91
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    92
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    93
class Personne(EntityType):
6208
07b176640a8c unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 6163
diff changeset
    94
    __unique_together__ = [('nom', 'prenom', 'datenaiss')]
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    95
    nom    = String(fulltextindexed=True, required=True, maxsize=64)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    96
    prenom = String(fulltextindexed=True, maxsize=64)
3546
f0aecddf367e fix bug when renaming a full text indexed attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3543
diff changeset
    97
    civility   = String(maxsize=1, default='M', fulltextindexed=True)
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    98
    promo  = String(vocabulary=('bon','pasbon'))
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    99
    titre  = String(fulltextindexed=True, maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   100
    adel   = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   101
    ass    = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   102
    web    = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   103
    tel    = Int()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   104
    fax    = Int()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   105
    datenaiss = Datetime()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   106
    test   = Boolean()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   107
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   108
    travaille = SubjectRelation('Societe')
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   109
    concerne = SubjectRelation('Affaire')
2745
0dafa29ace1f [schema migration] test reproducing pb when deleting a relation definition with mandatory card and without removing the associated rtype + fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2637
diff changeset
   110
    concerne2 = SubjectRelation(('Affaire', 'Note'), cardinality='1*')
4467
0e73d299730a fix long-waiting symetric typo: should be spelled symmetric. Add auto database migration on schema deserialization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
   111
    connait = SubjectRelation('Personne', symmetric=True)
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   112
9394
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   113
class concerne(RelationType):
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   114
    __permissions__ = {
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   115
        'read':   ('managers', 'users', 'guests'),
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   116
        'add':    ('managers', RRQLExpression('U has_update_permission S')),
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   117
        'delete': ('managers', RRQLExpression('O owned_by U')),
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   118
        }
8105
7980b36fb1aa [schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7711
diff changeset
   119
9394
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   120
# `Old` entity type is gonce
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   121
# `comments` is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   122
# `fiche` is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   123
# `multisource_*` rdefs are gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   124
# `see_also_*` rdefs are gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   125
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   126
class evaluee(RelationDefinition):
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   127
    subject = ('Personne', 'CWUser', 'Societe')
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   128
    object = ('Note')
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   129
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   130
class ecrit_par(RelationType):
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   131
    __permissions__ = {'read':   ('managers', 'users', 'guests',),
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   132
                   'delete': ('managers', ),
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   133
                   'add':    ('managers',
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   134
                              RRQLExpression('O require_permission P, P name "add_note", '
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   135
                                             'U in_group G, P require_group G'),)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   136
                   }
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   137
    inlined = True
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   138
    cardinality = '?*'
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   139
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   140
# `copain` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   141
# `tags` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   142
# `filed_under` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   143
# `require_permission` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   144
# `require_state` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   145
# `personne_composite` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   146
# `personne_inlined` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   147
# `login_user` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   148
# `ambiguous_inlined` rdef is gone
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   149
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   150
# New
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   151
class Text(Para):
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   152
    __specializes_schema__ = True
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   153
    summary = String(maxsize=512)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   154
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   155
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   156
# New
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   157
class Folder2(EntityType):
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   158
    """folders are used to classify entities. They may be defined as a tree.
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   159
    When you include the Folder entity, all application specific entities
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   160
    may then be classified using the "filed_under" relation.
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   161
    """
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   162
    name = String(required=True, indexed=True, internationalizable=True,
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   163
                  constraints=[UniqueConstraint(), SizeConstraint(64)])
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   164
    description = RichString(fulltextindexed=True)
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   165
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   166
# New
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   167
class filed_under2(RelationDefinition):
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   168
    subject ='*'
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   169
    object = 'Folder2'
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   170
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   171
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   172
# New
8105
7980b36fb1aa [schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7711
diff changeset
   173
class New(EntityType):
7980b36fb1aa [schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7711
diff changeset
   174
    new_name = String()
7980b36fb1aa [schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7711
diff changeset
   175
9394
4b89ca0b11ad [server/test] reorganize data/migratedapp/schema.py to allow comparison with data/schema.py
Julien Cristau <julien.cristau@logilab.fr>
parents: 9299
diff changeset
   176
# New
6163
407f54345687 [migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5575
diff changeset
   177
class same_as(RelationDefinition):
407f54345687 [migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5575
diff changeset
   178
    subject = ('Societe',)
407f54345687 [migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5575
diff changeset
   179
    object = 'ExternalUri'
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   180