add score field to db table and add alembic migration for the field

This commit is contained in:
maxDorninger
2025-07-16 23:27:54 +02:00
parent d01e5f5ee2
commit 83a09ebb94
2 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
"""Add score field to IndexerQueryResult table
Revision ID: 5299dfed220b
Revises: 1801d9f5a275
Create Date: 2025-07-16 23:24:37.931188
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "5299dfed220b"
down_revision: Union[str, None] = "1801d9f5a275"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"indexer_query_result",
sa.Column("score", sa.Integer(), nullable=False, server_default=sa.text("0")),
)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("indexer_query_result", "score")
# ### end Alembic commands ###

View File

@@ -21,3 +21,4 @@ class IndexerQueryResult(Base):
size = mapped_column(BigInteger)
usenet: Mapped[bool]
age: Mapped[int]
score: Mapped[int] = mapped_column(default=0)