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:
Kevin Morris 2022-09-06 14:26:08 -07:00
parent a84d115fa1
commit 94cc449a2d
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
6 changed files with 101 additions and 1 deletions

View file

@ -0,0 +1,31 @@
"""add MetaModifiedTS to PackageBase
Revision ID: 42584a60e7a7
Revises: d64e5571bc8d
Create Date: 2022-09-06 12:37:49.460344
"""
from alembic import op
from sqlalchemy.exc import OperationalError
from aurweb.models import PackageBase
# revision identifiers, used by Alembic.
revision = "42584a60e7a7"
down_revision = "d64e5571bc8d"
branch_labels = None
depends_on = None
table = PackageBase.__tablename__
def upgrade():
try:
op.add_column(table, PackageBase.__table__.c.MetaModifiedTS)
except OperationalError as e:
print(e)
print("MetaModifiedTS column already exists")
def downgrade():
op.remove_column(table, "MetaModifiedTS")