mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -04:00
* feat: server side search API (#2112) * refactor repository_recipes filter building * add food filter to recipe repository page_all * fix query type annotations * working search * add tests and make sure title matches are ordered correctly * remove instruction matching again * fix formatting and small issues * fix another linting error * make search test no rely on actual words * fix failing postgres compiled query * revise incorrectly ordered migration * automatically extract latest migration version * test migration orderes * run type generators * new search function * wip: new search page * sortable field options * fix virtual scroll issue * fix search casing bug * finalize search filters/sorts * remove old composable * fix type errors --------- Co-authored-by: Sören <fleshgolem@gmx.net>
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
import pathlib
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from tests.utils.alembic_reader import ALEMBIC_MIGRATIONS, import_file
|
|
|
|
|
|
class AlembicMigration(BaseModel):
|
|
path: pathlib.Path
|
|
revision: str | None
|
|
down_revision: str | None
|
|
|
|
|
|
def test_alembic_revisions_are_in_order() -> None:
|
|
# read all files
|
|
paths = sorted(ALEMBIC_MIGRATIONS.glob("*.py"))
|
|
|
|
# convert to sorted list of AlembicMigration
|
|
migrations: list[AlembicMigration] = []
|
|
|
|
for path in paths:
|
|
mod = import_file("alembic_version", path)
|
|
|
|
revision = getattr(mod, "revision", None)
|
|
down_revision = getattr(mod, "down_revision", None)
|
|
|
|
migrations.append(
|
|
AlembicMigration(
|
|
path=path,
|
|
revision=revision,
|
|
down_revision=down_revision,
|
|
)
|
|
)
|
|
|
|
# step through each migration and check
|
|
# - revision is in order
|
|
# - down_revision is in order
|
|
# - down_revision is the previous revision
|
|
last = None
|
|
for migration in migrations:
|
|
if last is not None:
|
|
assert (
|
|
last.revision == migration.down_revision
|
|
), f"{last.revision} != {migration.down_revision} for {migration.path}"
|
|
|
|
last = migration
|
|
last = migration
|