-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Description
Migration 0006_mariadb_uuid_conversion (added in v3.12.1 via PR #321) attempts to modify uuid columns in three tables, but two of those tables don't have uuid columns:
The Problem
The migration executes these SQL statements on MariaDB:
ALTER TABLE submissions_submission MODIFY uuid uuid NOT NULL -- ✅ This column EXISTS
ALTER TABLE submissions_studentitem MODIFY uuid uuid NOT NULL -- ❌ This column does NOT exist
ALTER TABLE submissions_score MODIFY uuid uuid NOT NULL -- ❌ This column does NOT existEvidence from models.py
Looking at submissions/models.py, only these models have UUID fields:
| Model | Has uuid field? |
|---|---|
Submission |
✅ Yes - line 315: uuid = models.UUIDField(...) |
TeamSubmission |
✅ Yes - line 128: uuid = models.UUIDField(...) |
SubmissionFile |
✅ Yes - line 753: uuid = models.UUIDField(...) |
StudentItem |
❌ No - only has student_id, course_id, item_id, item_type |
Score |
❌ No - only has foreign keys and score fields |
Error Message
When running migrations on a fresh Open edX Ulmo installation with MariaDB:
django.db.utils.OperationalError: (1054, "Unknown column 'uuid' in 'submissions_studentitem'")
Applying submissions.0006_mariadb_uuid_conversion...
Environment
- Open edX: Ulmo (December 2025)
- Tutor: 21.x
- edx-submissions: 3.12.1
- Database: MariaDB 10.11.x
- Django: 5.x
Suggested Fix
The migration should only modify submissions_submission table, since that's the only table with a uuid column that needs conversion:
def apply_mariadb_migration(apps, schema_editor):
# ... MariaDB check code ...
with connection.cursor() as cursor:
# Only Submission model has uuid field
cursor.execute(
"ALTER TABLE submissions_submission "
"MODIFY uuid uuid NOT NULL"
)
# Remove StudentItem and Score - they don't have uuid columnsWorkaround
For anyone encountering this issue, you can fake the migration:
./manage.py lms migrate submissions 0006_mariadb_uuid_conversion --fakeThis is safe because:
submissions_submission.uuidis already created as nativeuuidtype with Django 5StudentItemandScoredon't have uuid columns in the model definition
Related
- PR fix: Convert UUIDField columns to uuid type for MariaDB #321 that introduced this migration
- Reference article mentioned in migration: https://www.albertyw.com/note/django-5-mariadb-uuidfield
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels