Skip to content

Commit

Permalink
add missing migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanSchell committed Jun 27, 2024
1 parent 249735c commit 0848f05
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/syft/src/syft/service/code/user_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -1933,3 +1933,15 @@ def migrate_usercode_v5_to_v4() -> list[Callable]:
drop("origin_node_side_type"),
drop("l0_deny_reason"),
]


@migrate(UserCodeV5, UserCode)
def migrate_usercode_v5_to_v6() -> list[Callable]:
return [
drop("enclave_metadata"),
]


@migrate(UserCode, UserCodeV5)
def migrate_usercode_v6_to_v5() -> list[Callable]:
return [make_set_default("enclave_metadata", None)]
16 changes: 16 additions & 0 deletions packages/syft/src/syft/service/code_history/code_history.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# stdlib
from collections.abc import Callable
import json
from typing import Any

Expand All @@ -7,10 +8,13 @@
from ...client.enclave_client import EnclaveMetadata
from ...serde.serializable import serializable
from ...service.user.user_roles import ServiceRole
from ...types.syft_migration import migrate
from ...types.syft_object import SYFT_OBJECT_VERSION_2
from ...types.syft_object import SYFT_OBJECT_VERSION_3
from ...types.syft_object import SyftObject
from ...types.syft_object import SyftVerifyKey
from ...types.transforms import drop
from ...types.transforms import make_set_default
from ...types.uid import UID
from ...util.notebook_ui.components.tabulator_template import (
build_tabulator_table_with_data,
Expand Down Expand Up @@ -171,3 +175,15 @@ def _repr_html_(self) -> str | None:
"icon": None,
}
return build_tabulator_table_with_data(rows, metadata)


@migrate(CodeHistoryV2, CodeHistory)
def code_history_v2_to_v3() -> list[Callable]:
return [drop("enclave_metadata")]


@migrate(CodeHistory, CodeHistoryV2)
def code_history_v3_to_v2() -> list[Callable]:
return [
make_set_default("enclave_metadata", None),
]

0 comments on commit 0848f05

Please sign in to comment.