diff --git a/db/migrations/000007_retire_audio_conversation.down.sql b/db/migrations/000007_retire_audio_conversation.down.sql new file mode 100644 index 00000000..6e14cf13 --- /dev/null +++ b/db/migrations/000007_retire_audio_conversation.down.sql @@ -0,0 +1,3 @@ +UPDATE question_type_definitions +SET status='ACTIVE',updated_at=CURRENT_TIMESTAMP +WHERE key='audio_conversation_type'; diff --git a/db/migrations/000007_retire_audio_conversation.up.sql b/db/migrations/000007_retire_audio_conversation.up.sql new file mode 100644 index 00000000..60e4d8b8 --- /dev/null +++ b/db/migrations/000007_retire_audio_conversation.up.sql @@ -0,0 +1,5 @@ +-- Preserve existing questions, attempts, and definition IDs for historical reads. +-- Retire this language-learning type from the makeup academy authoring catalog. +UPDATE question_type_definitions +SET status='INACTIVE',updated_at=CURRENT_TIMESTAMP +WHERE key='audio_conversation_type'; diff --git a/docs/makeup-artistry-backend.md b/docs/makeup-artistry-backend.md index 6f435b6a..6367a0d2 100644 --- a/docs/makeup-artistry-backend.md +++ b/docs/makeup-artistry-backend.md @@ -77,8 +77,8 @@ passwords, payments, or subscriptions. It archives original empty CEFR/default p and unchanged, seed-owned general-learning courses. Existing authored changes are retained; course IDs, descendants, enrollments, and progress are not deleted. -The admin's Academy courses view excludes archived fixtures; Legacy archive retains access to -those historical records. Archived courses are unpublished and cannot be republished while +The admin course list excludes archived fixtures. Archived records are retained in storage +without a separate archive view in the admin. Archived courses are unpublished and cannot be republished while archived. Public catalog queries also exclude them explicitly. Three makeup starter courses contain six chapters, eighteen lesson outlines, and six quizzes @@ -91,3 +91,11 @@ seeder reuse these same IDs and preserves their publication status. Rollback restores only unchanged archived publication states. It retains starter drafts and their identity metadata to preserve later instructor edits and learner records. Reapplying the migration does not duplicate these courses. + +## Retired Audio Conversation definition + +Migration `000007_retire_audio_conversation` marks `audio_conversation_type` inactive. +Definition catalog lists exclude this retired language-learning type, including status/group +filters and total counts. Existing question references and responses are retained; direct +historical definition reads remain supported. Other custom audio-based definitions are unchanged. +The admin also excludes the retired key when connected to an older backend during rollout. diff --git a/internal/repository/questions.go b/internal/repository/questions.go index 1479ccec..527e3b6c 100644 --- a/internal/repository/questions.go +++ b/internal/repository/questions.go @@ -395,7 +395,8 @@ func (s *Store) GetQuestionTypeDefinitionByID(ctx context.Context, id int64) (do func (s *Store) ListQuestionTypeDefinitions(ctx context.Context, status *string, includeSystem bool, groupID *int64, limit, offset int32) ([]domain.QuestionTypeDefinition, int64, error) { const baseWhere = ` FROM question_type_definitions d - WHERE ($1::VARCHAR IS NULL OR d.status = $1) + WHERE d.key <> 'audio_conversation_type' + AND ($1::VARCHAR IS NULL OR d.status = $1) AND ($2::BOOLEAN = TRUE OR d.is_system = FALSE) AND ( $3::BIGINT IS NULL