1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 20:15:24 +02:00

feat: implement backup restoration from old db schemas (#2213)

* Remove some implicit lazy-loads from user serialization

* implement full backup restore across different database versions
This commit is contained in:
Sören 2023-03-12 21:39:51 +01:00 committed by GitHub
parent 3118b0e423
commit ccb0b43cef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 90 deletions

View file

@ -12,40 +12,3 @@ def test_alchemy_exporter():
assert data["alembic_version"] == alembic_versions()
assert json.dumps(data, indent=4) # Make sure data is json-serializable
def test_validate_schemas():
schema = {
"alembic_version": alembic_versions(),
}
match = {
"alembic_version": alembic_versions(),
}
invalid_version = {
"alembic_version": [{"version_num": "not-valid-schema"}],
}
assert AlchemyExporter.validate_schemas(schema, match)
assert not AlchemyExporter.validate_schemas(schema, invalid_version)
schema_with_tables = {
"alembic_version": alembic_versions(),
"recipes": [
{
"id": 1,
}
],
}
match_with_tables = {
"alembic_version": alembic_versions(),
"recipes": [
{
"id": 2,
}
],
}
assert AlchemyExporter.validate_schemas(schema_with_tables, match_with_tables)
assert AlchemyExporter.validate_schemas(schema_with_tables, match_with_tables)
assert AlchemyExporter.validate_schemas(schema_with_tables, match_with_tables)