From a18d5c9d8291bf4eeb21b450eca77c62c8c006f9 Mon Sep 17 00:00:00 2001 From: Evangelos Foutras Date: Mon, 25 Mar 2024 12:40:26 +0200 Subject: [PATCH] Drop md5sum column from Package model (#221) repo-add from Pacman 6.1 no longer adds MD5 checksums to the repository databases. There is no reason to keep it in the security tracker either so we can just drop the column. [1] https://gitlab.archlinux.org/pacman/pacman/-/commit/310bf878fcde --- ...d0b4cb352ca1_drop_package_md5sum_column.py | 31 +++++++++++++++++++ test/conftest.py | 3 +- tracker/maintenance.py | 1 - tracker/model/package.py | 1 - 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 migrations/versions/d0b4cb352ca1_drop_package_md5sum_column.py diff --git a/migrations/versions/d0b4cb352ca1_drop_package_md5sum_column.py b/migrations/versions/d0b4cb352ca1_drop_package_md5sum_column.py new file mode 100644 index 00000000..edbf74db --- /dev/null +++ b/migrations/versions/d0b4cb352ca1_drop_package_md5sum_column.py @@ -0,0 +1,31 @@ +"""drop package.md5sum column + +Revision ID: d0b4cb352ca1 +Revises: 2a69a8406f71 +Create Date: 2024-03-25 10:09:20.603755 + +""" +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = 'd0b4cb352ca1' +down_revision = '2a69a8406f71' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('package', schema=None) as batch_op: + batch_op.drop_column('md5sum') + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('package', schema=None) as batch_op: + batch_op.add_column(sa.Column('md5sum', sa.VARCHAR(length=32), nullable=False)) + + # ### end Alembic commands ### diff --git a/test/conftest.py b/test/conftest.py index 8ab12b81..3419d851 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -194,7 +194,7 @@ def wrapper(db, *args, **kwargs): def create_package(func=None, id=None, name=None, base=None, version='1.0-1', arch='any', database='core', description='', url=None, filename='somefile-1.0-1-any.tar.xz', - md5sum='md5', sha256sum='sha256', builddate=0): + sha256sum='sha256', builddate=0): def decorator(func): @wraps(func) def wrapper(db, *args, **kwargs): @@ -209,7 +209,6 @@ def wrapper(db, *args, **kwargs): package.description = description package.url = url package.filename = filename - package.md5sum = md5sum package.sha256sum = sha256sum package.builddate = builddate diff --git a/tracker/maintenance.py b/tracker/maintenance.py index 8fe849c4..12e11a1b 100644 --- a/tracker/maintenance.py +++ b/tracker/maintenance.py @@ -86,7 +86,6 @@ def update_package_cache(): 'arch': package.arch, 'database': package.db.name, 'filename': package.filename, - 'md5sum': package.md5sum, 'sha256sum': package.sha256sum, 'builddate': package.builddate }) diff --git a/tracker/model/package.py b/tracker/model/package.py index cf57d243..53b3f1fa 100644 --- a/tracker/model/package.py +++ b/tracker/model/package.py @@ -18,7 +18,6 @@ class Package(db.Model): description = db.Column(db.String(256), nullable=False) url = db.Column(db.String(192)) filename = db.Column(db.String(128), nullable=False) - md5sum = db.Column(db.String(32), nullable=False) sha256sum = db.Column(db.String(64), nullable=False) builddate = db.Column(db.Integer(), nullable=False)