aurweb/migrations/versions/42584a60e7a7_add_metamodifiedts_to_packagebase.py
Kevin Morris 94cc449a2d
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>
2022-09-06 20:36:36 -07:00

31 lines
675 B
Python

"""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")