Skip to content

Remove denormalized short_name from Exercise model #36

@nbars

Description

@nbars

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions