diff --git a/rhodecode/lib/dbmigrate/versions/115_version_5_1_0.py b/rhodecode/lib/dbmigrate/versions/115_version_5_1_0.py --- a/rhodecode/lib/dbmigrate/versions/115_version_5_1_0.py +++ b/rhodecode/lib/dbmigrate/versions/115_version_5_1_0.py @@ -35,16 +35,19 @@ def downgrade(migrate_engine): def fixups(models, _SESSION): + for db_repo in _SESSION.query(models.Repository).all(): - config = db_repo._config - config.set('extensions', 'largefiles', '') + try: + config = db_repo._config + config.set('extensions', 'largefiles', '') - try: - scm = db_repo.scm_instance(cache=False, config=config) + scm = db_repo.scm_instance(cache=False, config=config, vcs_full_cache=False) if scm: print(f'installing hook for repo: {db_repo}') scm.install_hooks(force=True) + del scm # force GC + del config except Exception as e: print(e) print('continue...')