-
Notifications
You must be signed in to change notification settings - Fork 229
Open
Description
Because of this code:
aiida-core/src/aiida/storage/sqlite_zip/backend.py
Lines 120 to 144 in f995713
@classmethod | |
def initialise(cls, profile: 'Profile', reset: bool = False) -> bool: | |
"""Initialise an instance of the ``SqliteZipBackend`` storage backend. | |
:param reset: If ``true``, destroy the backend if it already exists including all of its data before recreating | |
and initialising it. This is useful for example for test profiles that need to be reset before or after | |
tests having run. | |
:returns: ``True`` if the storage was initialised by the function call, ``False`` if it was already initialised. | |
""" | |
validate_sqlite_version() | |
from archive_path import ZipPath | |
filepath_archive = Path(profile.storage_config['filepath']) | |
if filepath_archive.exists() and not reset: | |
from .migrator import migrate | |
# The archive exists but ``reset == False``, so we try to migrate to the latest schema version. If the | |
# migration works, we replace the original archive with the migrated one. | |
with tempfile.TemporaryDirectory() as dirpath: | |
filepath_migrated = Path(dirpath) / 'migrated.zip' | |
LOGGER.report(f'Migrating existing {cls.__name__}') | |
migrate(filepath_archive, filepath_migrated, cls.version_head()) | |
shutil.move(filepath_migrated, filepath_archive) # type: ignore[arg-type] | |
return False |
the
migrate
function is always called, even if the archive version is recent and wouldn't require migration.Metadata
Metadata
Assignees
Labels
No labels