aurweb/migrations/versions/6441d3b65270_add_popularityupdated_to_packagebase.py
Kevin Morris 30e72d2db5 feat: archive git repository (experimental)
See doc/git-archive.md for general Git archive specifications
See doc/repos/metadata-repo.md for info and direction related to the new Git metadata archive
2022-09-24 16:51:25 +00:00

33 lines
750 B
Python

"""add PopularityUpdated to PackageBase
Revision ID: 6441d3b65270
Revises: d64e5571bc8d
Create Date: 2022-09-22 18:08:03.280664
"""
from alembic import op
from sqlalchemy.exc import OperationalError
from aurweb.models.package_base import PackageBase
from aurweb.scripts import popupdate
# revision identifiers, used by Alembic.
revision = "6441d3b65270"
down_revision = "d64e5571bc8d"
branch_labels = None
depends_on = None
table = PackageBase.__table__
def upgrade():
try:
op.add_column(table.name, table.c.PopularityUpdated)
except OperationalError:
print(f"table '{table.name}' already exists, skipping migration")
popupdate.run_variable()
def downgrade():
op.drop_column(table.name, "PopularityUpdated")