tribler.upgrade_script ====================== .. py:module:: tribler.upgrade_script .. autoapi-nested-parse:: UPDATE THIS FILE WHENEVER A NEW VERSION GETS RELEASED. Checklist: - Have you changed ``FROM`` to the previous version? - Have you changed ``TO`` to the current version? - Have you changed ``upgrade()`` to perform the upgrade? Attributes ---------- .. autoapisummary:: tribler.upgrade_script.FROM tribler.upgrade_script.TO tribler.upgrade_script.logger Functions --------- .. autoapisummary:: tribler.upgrade_script.batched tribler.upgrade_script._copy_if_not_exist tribler.upgrade_script._copy_if_exists tribler.upgrade_script._import_7_14_settings tribler.upgrade_script._inject_StatementOp_inner tribler.upgrade_script._inject_ChannelNode_inner tribler.upgrade_script._inject_ChannelNode tribler.upgrade_script._inject_TrackerState_inner tribler.upgrade_script._inject_TrackerState tribler.upgrade_script._inject_TorrentState_TrackerState_inner tribler.upgrade_script._inject_TorrentState_TrackerState tribler.upgrade_script._inject_7_14_tables tribler.upgrade_script.upgrade Module Contents --------------- .. py:data:: FROM :type: str :value: '7.14' .. py:data:: TO :type: str :value: '8.0' .. py:data:: logger .. py:function:: batched(results: list, n: int = 1) -> collections.abc.Generator[list] Backport for ``itertools.batched()``. .. py:function:: _copy_if_not_exist(src: str, dst: str) -> None Copy a file if it does not exist. .. py:function:: _copy_if_exists(src: configparser.ConfigParser, src_path: str, dst: tribler.tribler_config.TriblerConfigManager, dst_path: str, conversion: type) -> None Check if the src path is set and copy it into the dst if it is. .. py:function:: _import_7_14_settings(src: str, dst: tribler.tribler_config.TriblerConfigManager) -> None Read the file at the source path and import its settings. .. py:function:: _inject_StatementOp_inner(db: pony.orm.Database, batch: list) -> None The inner injection script to write old StatementOp info into the current database. .. py:function:: _inject_ChannelNode_inner(db: pony.orm.Database, batch: list) -> None The inner injection script to write old ChannelNode info into the current database. .. py:function:: _inject_ChannelNode(abs_src_db: str, abs_dst_db: str) -> None Import old ChannelNode entries. .. py:function:: _inject_TrackerState_inner(db: pony.orm.Database, batch: list) -> None The inner injection script to write old TrackerState info into the current database. .. py:function:: _inject_TrackerState(abs_src_db: str, abs_dst_db: str) -> None Import old TrackerState entries. .. py:function:: _inject_TorrentState_TrackerState_inner(db: pony.orm.Database, batch: list) -> None The inner injection script to write old TorrentState info into the current database. .. py:function:: _inject_TorrentState_TrackerState(abs_src_db: str, abs_dst_db: str) -> None Import old TorrentState_TrackerState entries. .. py:function:: _inject_7_14_tables(src_db: str, dst_db: str) -> None Fetch data from the old database and attempt to insert it into a new one. .. py:function:: upgrade(config: tribler.tribler_config.TriblerConfigManager, source: str, destination: str) -> None Perform the upgrade from the previous version to the next version. When complete, write a ".upgraded" file to the destination path. The files in ``source`` should be expected to be in the FROM format. The files in ``destination`` should be expected to be in the TO format. Make sure to deal with corruption and/or missing files!