mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: add PackageBase.MetaModifiedTS column
Since we cannot depend on InnoDB features across all mysql installations, we are instead using this new column to track metadata changes for a particular package base. This will allow us to fetch less data when producing metadata archives for end-users, and it does not depend on installation details aside from the schema/migrations being applied. New columns: - `PackageBase`.`MetaModifiedTS` Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
a84d115fa1
commit
94cc449a2d
6 changed files with 101 additions and 1 deletions
49
test/test_migrations.py
Normal file
49
test/test_migrations.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
import pytest
|
||||
|
||||
from aurweb import db
|
||||
from aurweb.models import PackageBase, User
|
||||
from aurweb.time import utcnow
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup(db_test: None) -> None:
|
||||
pass
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user() -> User:
|
||||
|
||||
with db.begin():
|
||||
user_ = db.create(User, Username="test", Email="test@example.org")
|
||||
|
||||
yield user_
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def pkgbase(user: User) -> PackageBase:
|
||||
now = utcnow()
|
||||
|
||||
with db.begin():
|
||||
pkgbase_ = db.create(
|
||||
PackageBase,
|
||||
Name="pkg",
|
||||
ModifiedTS=now,
|
||||
MetaModifiedTS=now,
|
||||
SubmittedTS=now,
|
||||
Maintainer=user,
|
||||
Packager=user,
|
||||
)
|
||||
|
||||
yield pkgbase_
|
||||
|
||||
|
||||
def test_package_base_columns(user: User, pkgbase: PackageBase):
|
||||
assert pkgbase.Name == "pkg"
|
||||
|
||||
assert bool(pkgbase.SubmittedTS)
|
||||
assert bool(pkgbase.ModifiedTS)
|
||||
assert bool(pkgbase.MetaModifiedTS)
|
||||
|
||||
assert pkgbase.Maintainer == user
|
||||
assert pkgbase.Packager == user
|
||||
assert pkgbase.Flagger is None
|
Loading…
Add table
Add a link
Reference in a new issue