Skip to content

Commit

Permalink
Drop md5sum column from Package model (archlinux#221)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
foutrelis authored Mar 25, 2024
1 parent edcc791 commit a18d5c9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
31 changes: 31 additions & 0 deletions migrations/versions/d0b4cb352ca1_drop_package_md5sum_column.py
Original file line number Diff line number Diff line change
@@ -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 ###
3 changes: 1 addition & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion tracker/maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
1 change: 0 additions & 1 deletion tracker/model/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit a18d5c9

Please sign in to comment.