Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions web/server/codechecker_server/database/run_db_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,3 +693,37 @@ class FilterPreset(Base):
def __init__(self, preset_name, report_filter):
self.preset_name = preset_name
self.report_filter = report_filter


class RunLabel(Base):
__tablename__ = 'run_labels'

id = Column(
BigInteger().with_variant(Integer, "sqlite"),
primary_key=True
)
label_name = Column(String, nullable=False, unique=True, index=True)
description = Column(String, nullable=True)

def __init__(self, label_name, description=None):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add type annotations for function parameters.

self.label_name = label_name
self.description = description


class RunToRunLabel(Base):
__tablename__ = 'run_to_run_labels'

run_id = Column(
BigInteger().with_variant(Integer, "sqlite"),
ForeignKey('runs.id', ondelete='CASCADE'),
primary_key=True
)
run_label_id = Column(
BigInteger().with_variant(Integer, "sqlite"),
ForeignKey('run_labels.id', ondelete='CASCADE'),
primary_key=True
)

def __init__(self, run_id, run_label_id):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add type annotations for function parameters.

self.run_id = run_id
self.run_label_id = run_label_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"""
add run labels

Revision ID: 57f54912b62f
Revises: feb5f01b5b52
Create Date: 2026-10-06 08:56:56.071397
"""

from logging import getLogger

from alembic import op
import sqlalchemy as sa


# Revision identifiers, used by Alembic.
revision = '57f54912b62f'
down_revision = 'feb5f01b5b52'
branch_labels = None
depends_on = None


def upgrade():
op.create_table(
'run_labels',
sa.Column(
'id',
sa.BigInteger().with_variant(sa.Integer, "sqlite"),
autoincrement=True,
nullable=False
),
sa.Column('label_name', sa.String, nullable=False),
sa.Column('description', sa.String, nullable=True),
sa.PrimaryKeyConstraint('id', name='pk_run_labels'),
)

op.create_table(
'run_to_run_labels',
sa.Column(
'run_id',
sa.BigInteger().with_variant(sa.Integer, "sqlite"),
nullable=False
),
sa.Column(
'run_label_id',
sa.BigInteger().with_variant(sa.Integer, "sqlite"),
nullable=False
),
sa.ForeignKeyConstraint(
['run_id'],
['runs.id'],
name='fk_run_to_run_labels_run_id_runs',
ondelete='CASCADE'
),
sa.ForeignKeyConstraint(
['run_label_id'],
['run_labels.id'],
name='fk_run_to_run_labels_run_label_id_run_labels',
ondelete='CASCADE'
),
sa.PrimaryKeyConstraint(
'run_id',
'run_label_id',
name='pk_run_to_run_labels'
)
)

op.create_index(
'ix_run_to_run_labels_run_label_id',
'run_to_run_labels',
['run_label_id'],
unique=False
)


def downgrade():
op.drop_index(
'ix_run_to_run_labels_run_label_id',
table_name='run_to_run_labels'
)
op.drop_table('run_to_run_labels')
op.drop_table('run_labels')
Loading