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:
parent
3118b0e423
commit
ccb0b43cef
5 changed files with 71 additions and 90 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue