1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
18 """allways executed before all others in server migration |
18 """allways executed before all others in server migration |
19 |
19 |
20 it should only include low level schema changes |
20 it should only include low level schema changes |
21 """ |
21 """ |
22 |
22 |
|
23 from cubicweb import ConfigurationError |
23 from cubicweb.server.session import hooks_control |
24 from cubicweb.server.session import hooks_control |
24 from cubicweb.server import schemaserial as ss |
25 from cubicweb.server import schemaserial as ss |
25 |
26 |
26 applcubicwebversion, cubicwebversion = versions_map['cubicweb'] |
27 applcubicwebversion, cubicwebversion = versions_map['cubicweb'] |
27 |
28 |
35 commit(ask_confirm=False) |
36 commit(ask_confirm=False) |
36 |
37 |
37 if applcubicwebversion < (3, 17, 0) and cubicwebversion >= (3, 17, 0): |
38 if applcubicwebversion < (3, 17, 0) and cubicwebversion >= (3, 17, 0): |
38 try: |
39 try: |
39 add_cube('sioc', update_database=False) |
40 add_cube('sioc', update_database=False) |
40 except ImportError: |
41 except ConfigurationError: |
41 if not confirm('In cubicweb 3.17 sioc views have been moved to the sioc ' |
42 if not confirm('In cubicweb 3.17 sioc views have been moved to the sioc ' |
42 'cube, which is not installed. Continue anyway?'): |
43 'cube, which is not installed. Continue anyway?'): |
43 raise |
44 raise |
44 try: |
45 try: |
45 add_cube('embed', update_database=False) |
46 add_cube('embed', update_database=False) |
46 except ImportError: |
47 except ConfigurationError: |
47 if not confirm('In cubicweb 3.17 embedding views have been moved to the embed ' |
48 if not confirm('In cubicweb 3.17 embedding views have been moved to the embed ' |
48 'cube, which is not installed. Continue anyway?'): |
49 'cube, which is not installed. Continue anyway?'): |
49 raise |
50 raise |
50 try: |
51 try: |
51 add_cube('geocoding', update_database=False) |
52 add_cube('geocoding', update_database=False) |
52 except ImportError: |
53 except ConfigurationError: |
53 if not confirm('In cubicweb 3.17 geocoding views have been moved to the geocoding ' |
54 if not confirm('In cubicweb 3.17 geocoding views have been moved to the geocoding ' |
54 'cube, which is not installed. Continue anyway?'): |
55 'cube, which is not installed. Continue anyway?'): |
55 raise |
56 raise |
56 |
57 |
57 if applcubicwebversion <= (3, 13, 0) and cubicwebversion >= (3, 13, 1): |
58 if applcubicwebversion <= (3, 13, 0) and cubicwebversion >= (3, 13, 1): |
70 if applcubicwebversion <= (3, 14, 0) and cubicwebversion >= (3, 14, 0): |
71 if applcubicwebversion <= (3, 14, 0) and cubicwebversion >= (3, 14, 0): |
71 if 'require_permission' in schema and not 'localperms'in repo.config.cubes(): |
72 if 'require_permission' in schema and not 'localperms'in repo.config.cubes(): |
72 from cubicweb import ExecutionError |
73 from cubicweb import ExecutionError |
73 try: |
74 try: |
74 add_cube('localperms', update_database=False) |
75 add_cube('localperms', update_database=False) |
75 except ImportError: |
76 except ConfigurationError: |
76 raise ExecutionError('In cubicweb 3.14, CWPermission and related stuff ' |
77 raise ExecutionError('In cubicweb 3.14, CWPermission and related stuff ' |
77 'has been moved to cube localperms. Install it first.') |
78 'has been moved to cube localperms. Install it first.') |
78 |
79 |
79 if applcubicwebversion == (3, 6, 0) and cubicwebversion >= (3, 6, 0): |
80 if applcubicwebversion == (3, 6, 0) and cubicwebversion >= (3, 6, 0): |
80 CSTRMAP = dict(rql('Any T, X WHERE X is CWConstraintType, X name T', |
81 CSTRMAP = dict(rql('Any T, X WHERE X is CWConstraintType, X name T', |