PrevEmployment: add FK user_account → employee.user_account with ON UPDATE CASCADE
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start with api/db/schema/prev_employment.py and the Alembic migration for #138 to follow the existing foreign key pattern. Check how migrations detect and report orphaned prev_employment rows, then add the constraint with ON UPDATE CASCADE and default delete behavior. Add tests for cascading employee account updates and rejecting unknown accounts; done when both behaviors pass and orphan handling is explicit.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
PrevEmployment.user_account is a bare UUID column with no relation to Employee. Align it with the decision made for StudentDocuments in #138.
Goal
Add a foreign key PrevEmployment.user_account → employee.user_account with ON UPDATE CASCADE, so that:
- no
PrevEmploymentrow can reference a non-existent user (referential integrity) - remapping
employee.user_account(e.g. during the planned account fusion migration) updatesPrevEmploymentautomatically
Lookups keep using the JWT sub directly; no join through Employee is needed.
Tasks
- Alembic migration adding the FK constraint (
ON UPDATE CASCADE; delete behaviour stays as default/restrict) - Before adding the constraint: detect orphaned
prev_employmentrows whoseuser_accounthas no matchingemployeerow, and decide how to handle them (delete / report). The migration must not fail silently. - Update the SQLModel schema
api/db/schema/prev_employment.py(foreign_key="employee.user_account",ondelete/onupdateviasa_column_kwargsorsa_column) - Test: updating
employee.user_accountcascades toprev_employment.user_account - Test: inserting a
PrevEmploymentwith an unknownuser_accountfails
Out of scope
- Changes to the PrevEmployment endpoints
Related: #138
- Ngôn ngữ chính
- Python
- Star
- 0
- Fork
- 0
- Merge trung bình
- 29 phút
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ClockGU/clockwork-backend
-
Add alembic upgrade predeployĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ClockGU/clockwork-backend#169 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Refactor - Mail sending and EmailHandlerCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
ClockGU/clockwork-backend#176 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
ClockGU/clockwork-backend#165 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
ClockGU/clockwork-backend#164 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[#160] Refactor EmployeeManagerĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
ClockGU/clockwork-backend#163 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ClockGU/clockwork-backend
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
yt-project/yt#5624 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NousResearch/hermes-agent#148376 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Analysis
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SACGF/variantgrid#2615 ·
Maintainer thường phản hồi trong vòng 1 ngày