feat: ensure deletion of custom fields and values when a board is deleted
This commit is contained in:
@@ -23,6 +23,7 @@ from app.models.board_webhooks import BoardWebhook
|
||||
from app.models.organization_board_access import OrganizationBoardAccess
|
||||
from app.models.organization_invite_board_access import OrganizationInviteBoardAccess
|
||||
from app.models.tag_assignments import TagAssignment
|
||||
from app.models.task_custom_fields import BoardTaskCustomField, TaskCustomFieldValue
|
||||
from app.models.task_dependencies import TaskDependency
|
||||
from app.models.task_fingerprints import TaskFingerprint
|
||||
from app.models.tasks import Task
|
||||
@@ -84,6 +85,12 @@ async def delete_board(session: AsyncSession, *, board: Board) -> OkResponse:
|
||||
col(TagAssignment.task_id).in_(task_ids),
|
||||
commit=False,
|
||||
)
|
||||
await crud.delete_where(
|
||||
session,
|
||||
TaskCustomFieldValue,
|
||||
col(TaskCustomFieldValue.task_id).in_(task_ids),
|
||||
commit=False,
|
||||
)
|
||||
# Keep teardown ordered around FK/reference chains so dependent rows are gone
|
||||
# before deleting their parent task/agent/board records.
|
||||
await crud.delete_where(
|
||||
@@ -129,6 +136,11 @@ async def delete_board(session: AsyncSession, *, board: Board) -> OkResponse:
|
||||
OrganizationInviteBoardAccess,
|
||||
col(OrganizationInviteBoardAccess.board_id) == board.id,
|
||||
)
|
||||
await crud.delete_where(
|
||||
session,
|
||||
BoardTaskCustomField,
|
||||
col(BoardTaskCustomField.board_id) == board.id,
|
||||
)
|
||||
|
||||
# Tasks reference agents and have dependent records.
|
||||
# Delete tasks before agents.
|
||||
|
||||
Reference in New Issue
Block a user