Greg commited on
Commit
fa350fe
·
1 Parent(s): 9f37e9c

docs(ta-01): warn about photo data loss; tighten FK ondelete

Browse files
backend/alembic/versions/028_ta01_storage_and_attendance_attribution.py CHANGED
@@ -1,12 +1,17 @@
1
  """TA-01: storage paths and attendance attribution
2
 
 
 
 
 
 
 
 
 
 
3
  Revision ID: 028
4
  Revises: 027
5
  Create Date: 2026-06-05
6
-
7
- Changes:
8
- - Bloque A: face_encodings.photo from Text(base64) to VARCHAR(500) URL/path
9
- - Bloque B: attendance attribution traceability (marked_by_role, marked_by_user_id)
10
  """
11
 
12
  from alembic import op
@@ -47,6 +52,7 @@ def upgrade() -> None:
47
  "fk_attendances_marked_by_user",
48
  "attendances", "users",
49
  ["marked_by_user_id"], ["id"],
 
50
  )
51
  op.create_index(
52
  "ix_attendances_marked_by_user_id",
@@ -55,6 +61,7 @@ def upgrade() -> None:
55
 
56
 
57
  def downgrade() -> None:
 
58
  op.drop_index("ix_attendances_marked_by_user_id", table_name="attendances")
59
  op.drop_constraint("fk_attendances_marked_by_user", "attendances", type_="foreignkey")
60
  op.drop_column("attendances", "marked_by_user_id")
 
1
  """TA-01: storage paths and attendance attribution
2
 
3
+ WARNING: Upgrade deletes all existing face_encodings.photo data
4
+ (was base64; now URL/path). Admins must re-upload after deployment.
5
+ Downgrade does NOT restore the deleted photos.
6
+
7
+ Bloque A: face_encodings.photo Text(base64) → VARCHAR(500) URL/path;
8
+ face_encodings.encoding allowed to be NULL.
9
+ Bloque B: attendances gets marked_by_role + marked_by_user_id for
10
+ attribution traceability (teacher | admin | kiosco).
11
+
12
  Revision ID: 028
13
  Revises: 027
14
  Create Date: 2026-06-05
 
 
 
 
15
  """
16
 
17
  from alembic import op
 
52
  "fk_attendances_marked_by_user",
53
  "attendances", "users",
54
  ["marked_by_user_id"], ["id"],
55
+ ondelete="SET NULL",
56
  )
57
  op.create_index(
58
  "ix_attendances_marked_by_user_id",
 
61
 
62
 
63
  def downgrade() -> None:
64
+ # NOTE: Photo data deleted in upgrade is NOT restored here.
65
  op.drop_index("ix_attendances_marked_by_user_id", table_name="attendances")
66
  op.drop_constraint("fk_attendances_marked_by_user", "attendances", type_="foreignkey")
67
  op.drop_column("attendances", "marked_by_user_id")