Show More
@@ -0,0 +1,28 b'' | |||||
|
1 | import logging | |||
|
2 | import datetime | |||
|
3 | ||||
|
4 | from sqlalchemy import * | |||
|
5 | from sqlalchemy.exc import DatabaseError | |||
|
6 | from sqlalchemy.orm import relation, backref, class_mapper, joinedload | |||
|
7 | from sqlalchemy.orm.session import Session | |||
|
8 | from sqlalchemy.ext.declarative import declarative_base | |||
|
9 | ||||
|
10 | from rhodecode.lib.dbmigrate.migrate import * | |||
|
11 | from rhodecode.lib.dbmigrate.migrate.changeset import * | |||
|
12 | ||||
|
13 | from rhodecode.model.meta import Base | |||
|
14 | from rhodecode.model import meta | |||
|
15 | ||||
|
16 | log = logging.getLogger(__name__) | |||
|
17 | ||||
|
18 | ||||
|
19 | def upgrade(migrate_engine): | |||
|
20 | """ | |||
|
21 | Upgrade operations go here. | |||
|
22 | Don't create your own engine; bind migrate_engine to your metadata | |||
|
23 | """ | |||
|
24 | pass | |||
|
25 | ||||
|
26 | def downgrade(migrate_engine): | |||
|
27 | meta = MetaData() | |||
|
28 | meta.bind = migrate_engine |
@@ -38,7 +38,7 b' except ImportError:' | |||||
38 |
|
38 | |||
39 | __version__ = ('.'.join((str(each) for each in VERSION[:3])) + |
|
39 | __version__ = ('.'.join((str(each) for each in VERSION[:3])) + | |
40 | '.'.join(VERSION[3:])) |
|
40 | '.'.join(VERSION[3:])) | |
41 |
__dbversion__ = |
|
41 | __dbversion__ = 9 # defines current db version for migrations | |
42 | __platform__ = platform.system() |
|
42 | __platform__ = platform.system() | |
43 | __license__ = 'GPLv3' |
|
43 | __license__ = 'GPLv3' | |
44 | __py_version__ = sys.version_info |
|
44 | __py_version__ = sys.version_info |
@@ -276,6 +276,16 b' class DbManage(object):' | |||||
276 | self.klass.create_default_options(skip_existing=True) |
|
276 | self.klass.create_default_options(skip_existing=True) | |
277 | Session().commit() |
|
277 | Session().commit() | |
278 |
|
278 | |||
|
279 | def step_9(self): | |||
|
280 | perm_fixes = self.klass.reset_permissions(User.DEFAULT_USER) | |||
|
281 | Session().commit() | |||
|
282 | if perm_fixes: | |||
|
283 | notify('There was an inconsistent state of permissions ' | |||
|
284 | 'detected for default user. Permissions are now ' | |||
|
285 | 'reset to the default value for default user. ' | |||
|
286 | 'Please validate and check default permissions ' | |||
|
287 | 'in admin panel') | |||
|
288 | ||||
279 | upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1) |
|
289 | upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1) | |
280 |
|
290 | |||
281 | # CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE |
|
291 | # CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE |
General Comments 0
You need to be logged in to leave comments.
Login now