feat: use Alembic to initialize the database

This completely removes the previous DB patching mechanism.
When this is first run for an existing installation of Unwind, depending
on its version it might lead to problems because the database's schema
won't match the code.
To avoid that issue, when upgrading Unwind to this version make sure to
STOP the old application, install this new version but DON'T start it,
instead use `alembic upgrade head` to run the outstanding patches, and
only then start the application.
This commit is contained in:
ducklet 2024-05-19 02:25:36 +02:00
parent 5e4e70c9dc
commit 1ea09c1a45
20 changed files with 72 additions and 560 deletions

View file

@ -20,14 +20,6 @@ def a_movie(**kwds) -> models.Movie:
return models.Movie(**args)
@pytest.mark.asyncio
async def test_current_patch_level(conn: db.Connection):
patch_level = "some-patch-level"
assert patch_level != await db.current_patch_level(conn)
await db.set_current_patch_level(conn, patch_level)
assert patch_level == await db.current_patch_level(conn)
@pytest.mark.asyncio
async def test_get(conn: db.Connection):
m1 = a_movie()