Skip to content

Commit c8d8a22

Browse files
committed
Clarify migration handles all blob type variants
1 parent 9bd37f6 commit c8d8a22

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

docs/src/design/tables/customtype.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,15 @@ print(f"Migrated {result['migrated']} columns")
556556
The migration updates MySQL column comments to include the type declaration.
557557
This is a **metadata-only** change - the actual blob data format is unchanged.
558558

559+
All blob type variants are handled: `tinyblob`, `blob`, `mediumblob`, `longblob`.
560+
559561
Before migration:
560-
- Column: `longblob`
562+
- Column: `longblob` (or `blob`, `mediumblob`, etc.)
561563
- Comment: `user comment`
562564
- Behavior: Auto-serialization (implicit)
563565

564566
After migration:
565-
- Column: `longblob`
567+
- Column: `longblob` (unchanged)
566568
- Comment: `:<djblob>:user comment`
567569
- Behavior: Explicit serialization via `<djblob>`
568570

src/datajoint/migrate.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ def analyze_blob_columns(schema: Schema) -> list[dict]:
3232
1. Have a MySQL blob type (tinyblob, blob, mediumblob, longblob)
3333
2. Do NOT already have an adapter/type specified in their comment
3434
35+
All blob size variants are included in the analysis.
36+
3537
Args:
3638
schema: The DataJoint schema to analyze.
3739
3840
Returns:
3941
List of dicts with keys:
4042
- table_name: Full table name (database.table)
4143
- column_name: Name of the blob column
42-
- column_type: MySQL column type
44+
- column_type: MySQL column type (tinyblob, blob, mediumblob, longblob)
4345
- current_comment: Current column comment
4446
- needs_migration: True if column should be migrated
4547
@@ -49,7 +51,7 @@ def analyze_blob_columns(schema: Schema) -> list[dict]:
4951
>>> columns = dj.migrate.analyze_blob_columns(schema)
5052
>>> for col in columns:
5153
... if col['needs_migration']:
52-
... print(f"{col['table_name']}.{col['column_name']}")
54+
... print(f"{col['table_name']}.{col['column_name']} ({col['column_type']})")
5355
"""
5456
results = []
5557

0 commit comments

Comments
 (0)