Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot fix #48

Merged
merged 3 commits into from
Nov 20, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Making value from Metric nullable

Revision ID: 943ea08a8a82
Revises: d1dc98f61aee
Create Date: 2024-11-19 14:53:47.781164

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from alembic_utils.pg_grant_table import PGGrantTable
from sqlalchemy import text as sql_text

# revision identifiers, used by Alembic.
revision: str = '943ea08a8a82'
down_revision: Union[str, None] = 'd1dc98f61aee'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.alter_column('metric', 'value',
existing_type=sa.VARCHAR(),
nullable=True)


def downgrade() -> None:
op.alter_column('metric', 'value',
existing_type=sa.VARCHAR(),
nullable=False)
2 changes: 2 additions & 0 deletions project_tracking/db_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,8 @@ def ingest_run_processing(project_id: str, ingest_data, session=None):
except exc.IntegrityError as error:
session.rollback()
message = unique_constraint_error(session, "run_processing", ingest_data)
if not message:
raise UniqueConstraintError(message=str(error.orig)) from error
raise UniqueConstraintError(message=message) from error

operation_id = operation.id
Expand Down
4 changes: 2 additions & 2 deletions project_tracking/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,9 @@ class Metric(BaseTable):
"""
__tablename__ = "metric"

name: Mapped[str] = mapped_column()
name: Mapped[str] = mapped_column(nullable=False)
job_id: Mapped[int] = mapped_column(ForeignKey("job.id"), default=None)
value: Mapped[str] = mapped_column()
value: Mapped[str] = mapped_column(default=None, nullable=True)
flag: Mapped[FlagEnum] = mapped_column(default=None, nullable=True)
deliverable: Mapped[bool] = mapped_column(default=False)
aggregate: Mapped[AggregateEnum] = mapped_column(default=None, nullable=True)
Expand Down