diff options
author | Shay <hillerys@element.io> | 2023-04-25 11:52:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-25 11:52:54 -0700 |
commit | 710502c6d868ed0d6844e081bd0654eb51723733 (patch) | |
tree | c6001a5d5e4034ea8513bdad7ae39722b3088af1 | |
parent | Add unstable /keys/claim endpoint which always returns fallback keys. (#15462) (diff) | |
download | synapse-710502c6d868ed0d6844e081bd0654eb51723733.tar.xz |
Update the `check_schema_delta` script to account for when the schema version has been bumped locally (#15466)
-rw-r--r-- | changelog.d/15466.bugfix | 1 | ||||
-rwxr-xr-x | scripts-dev/check_schema_delta.py | 26 |
2 files changed, 25 insertions, 2 deletions
diff --git a/changelog.d/15466.bugfix b/changelog.d/15466.bugfix new file mode 100644 index 0000000000..299a7f0f0e --- /dev/null +++ b/changelog.d/15466.bugfix @@ -0,0 +1 @@ +Update the check_schema_delta script to account for when the schema version has been bumped locally. diff --git a/scripts-dev/check_schema_delta.py b/scripts-dev/check_schema_delta.py index 32fe7f50de..fee4a8bd3d 100755 --- a/scripts-dev/check_schema_delta.py +++ b/scripts-dev/check_schema_delta.py @@ -40,10 +40,32 @@ def main(force_colors: bool) -> None: exec(r, locals) current_schema_version = locals["SCHEMA_VERSION"] - click.secho(f"Current schema version: {current_schema_version}") - diffs: List[git.Diff] = repo.remote().refs.develop.commit.diff(None) + # Get the schema version of the local file to check against current schema on develop + with open("synapse/storage/schema/__init__.py", "r") as file: + local_schema = file.read() + new_locals: Dict[str, Any] = {} + exec(local_schema, new_locals) + local_schema_version = new_locals["SCHEMA_VERSION"] + + if local_schema_version != current_schema_version: + # local schema version must be +/-1 the current schema version on develop + if abs(local_schema_version - current_schema_version) != 1: + click.secho( + "The proposed schema version has diverged more than one version from develop, please fix!", + fg="red", + bold=True, + color=force_colors, + ) + click.get_current_context().exit(1) + + # right, we've changed the schema version within the allowable tolerance so + # let's now use the local version as the canonical version + current_schema_version = local_schema_version + + click.secho(f"Current schema version: {current_schema_version}") + seen_deltas = False bad_files = [] for diff in diffs: |