Show More
@@ -0,0 +1,50 b'' | |||
|
1 | ||
|
2 | ||
|
3 | import logging | |
|
4 | from sqlalchemy import * | |
|
5 | from sqlalchemy.engine import reflection | |
|
6 | ||
|
7 | from alembic.migration import MigrationContext | |
|
8 | from alembic.operations import Operations | |
|
9 | ||
|
10 | from rhodecode.lib.dbmigrate.versions import _reset_base | |
|
11 | from rhodecode.model import meta, init_model_encryption | |
|
12 | ||
|
13 | ||
|
14 | log = logging.getLogger(__name__) | |
|
15 | ||
|
16 | ||
|
17 | def _get_indexes_list(migrate_engine, table_name): | |
|
18 | inspector = reflection.Inspector.from_engine(migrate_engine) | |
|
19 | return inspector.get_indexes(table_name) | |
|
20 | ||
|
21 | ||
|
22 | def upgrade(migrate_engine): | |
|
23 | """ | |
|
24 | Upgrade operations go here. | |
|
25 | Don't create your own engine; bind migrate_engine to your metadata | |
|
26 | """ | |
|
27 | from rhodecode.model import db as db_5_1_0_0 | |
|
28 | ||
|
29 | # issue fixups | |
|
30 | fixups(db_5_1_0_0, meta.Session) | |
|
31 | ||
|
32 | ||
|
33 | def downgrade(migrate_engine): | |
|
34 | pass | |
|
35 | ||
|
36 | ||
|
37 | def fixups(models, _SESSION): | |
|
38 | for db_repo in _SESSION.query(models.Repository).all(): | |
|
39 | ||
|
40 | config = db_repo._config | |
|
41 | config.set('extensions', 'largefiles', '') | |
|
42 | ||
|
43 | try: | |
|
44 | scm = db_repo.scm_instance(cache=False, config=config) | |
|
45 | if scm: | |
|
46 | print(f'installing hook for repo: {db_repo}') | |
|
47 | scm.install_hooks(force=True) | |
|
48 | except Exception as e: | |
|
49 | print(e) | |
|
50 | print('continue...') |
@@ -82,7 +82,7 b' PYRAMID_SETTINGS = {}' | |||
|
82 | 82 | EXTENSIONS = {} |
|
83 | 83 | |
|
84 | 84 | __version__ = ('.'.join((str(each) for each in VERSION[:3]))) |
|
85 |
__dbversion__ = 11 |
|
|
85 | __dbversion__ = 115 # defines current db version for migrations | |
|
86 | 86 | __license__ = 'AGPLv3, and Commercial License' |
|
87 | 87 | __author__ = 'RhodeCode GmbH' |
|
88 | 88 | __url__ = 'https://code.rhodecode.com' |
General Comments 0
You need to be logged in to leave comments.
Login now