Summary
Exercise.short_name is currently denormalized — it exists on both Exercise and ExerciseConfig. This was done to avoid breaking SQLAlchemy queries, Docker resource naming, and SSH routing during the ExerciseConfig migration.
Goal
Remove short_name from the Exercise model and always resolve it through the ExerciseConfig relationship (exercise.config.short_name). This eliminates the need to keep both in sync on rename.
What needs to change
- Remove
Exercise.short_name column and add a proxy property
- Update all SQLAlchemy queries that filter on
Exercise.short_name to join through ExerciseConfig
- Update Docker resource naming (
core/instance.py, core/image.py) to use exercise.config.short_name
- Update SSH routing (
view/api.py) to query via ExerciseConfig
- DB migration to drop the column
- Update the rename logic in
exercise_edit_config (no longer needs to update Exercise rows)
Context
Introduced in commit ef478f8 (ExerciseConfig migration). See comment on Exercise.short_name in webapp/ref/model/exercise.py.
Summary
Exercise.short_nameis currently denormalized — it exists on bothExerciseandExerciseConfig. This was done to avoid breaking SQLAlchemy queries, Docker resource naming, and SSH routing during the ExerciseConfig migration.Goal
Remove
short_namefrom theExercisemodel and always resolve it through theExerciseConfigrelationship (exercise.config.short_name). This eliminates the need to keep both in sync on rename.What needs to change
Exercise.short_namecolumn and add a proxy propertyExercise.short_nameto join throughExerciseConfigcore/instance.py,core/image.py) to useexercise.config.short_nameview/api.py) to query viaExerciseConfigexercise_edit_config(no longer needs to update Exercise rows)Context
Introduced in commit ef478f8 (ExerciseConfig migration). See comment on
Exercise.short_nameinwebapp/ref/model/exercise.py.