Skip to content
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
1 change: 1 addition & 0 deletions qualia/backend/app/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from app.models.section import Section
from app.models.form_cycle import FormCycle, FormCycleStatus
from app.models.user import Role, User
20 changes: 20 additions & 0 deletions qualia/backend/app/models/section.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import uuid

from sqlalchemy import Integer, String, UniqueConstraint, Uuid, text
from sqlalchemy.orm import Mapped, mapped_column

from app.core.database import Base


class Section(Base):
__tablename__ = "section"
__table_args__ = (
UniqueConstraint("form_cycle_id", "display_order", name="uq_section_form_display_order"),
)

id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4)
form_cycle_id: Mapped[uuid.UUID] = mapped_column(Uuid, index=True, nullable=False)
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 27, 2026

Choose a reason for hiding this comment

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

form_cycle_id looks like it references another table, but there’s no DB-level foreign key constraint here; that can allow orphan Section rows and makes integrity dependent on application code.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

value:valid-but-wont-fix; category:bug; feedback:Marked valid-but-wont-fix because the integrity concern is correct, but this PR base does not include the referenced form cycle table yet. Adding that foreign key now would make metadata creation depend on a table outside this slice and can break model loading.

title: Mapped[str | None] = mapped_column(String(255), nullable=True)
display_order: Mapped[int] = mapped_column(
Integer, default=1, server_default=text("1"), nullable=False
)