[QTI] Make unstable's migration graph match the migrations applied in production

未关闭
#6,342 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
20/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
django, python
领域
backend, database

调研方向

The issue identifies the migration graph and the relevant migrations: 0168_alter_assessmentitem_type, 0169_invitation_organization, and the leaf migrations named in the acceptance criteria. Read those migration files and Django’s migration documentation, then check the production and unstable histories described here. Done means both histories migrate successfully and makemigrations --check reports no changes; the issue says it is not open for contribution.

由索引模型根据 Issue 内容生成。

描述

DEV: backend

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

As unstable stands today, the QTI release will fail to deploy at migrate, so unstable's migration graph needs to match what production has applied.

  • Production has applied 0168_alter_assessmentitem_type on top of 0167_file_size_bigint_expand.
  • Unstable's copy of 0168 depends on 0167_add_organization, which production has never applied.
  • Django refuses to migrate a database where an applied migration has an unapplied dependency, and raises InconsistentMigrationHistory.

Part of #6337. Starts after the hotfixes → unstable merge that brings in 0169_file_size_bigint_swap, so it can be tested against production's full history. Must be in unstable before the QTI release is cut.

Complexity: Low
Target branch: unstable

Context
  • master / hotfixes: 0166 → 0167_file_size_bigint_expand → 0168_alter_assessmentitem_type → 0169_file_size_bigint_swap.
  • unstable: 0166 → 0167_add_organization → 0168_alter_assessmentitem_type → 0169_invitation_organization.
  • On unstable, 0170_merge_20260717_0136 merges 0167_file_size_bigint_expand with 0169_invitation_organization.
  • 0169_file_size_bigint_swap also depends on 0168, and reaches unstable with the next hotfixes → unstable merge.
  • That merge leaves two leaf migrations, so the merge PR must add a merge migration: Django refuses to migrate without one, and CI's makemigrations --check fails.
  • The conflict is in unstable today. The hotfixes → unstable merge doesn't cause it, and doesn't fix it.
The Change
  • Point unstable's 0168 back to 0167_file_size_bigint_expand, as in production.
  • Make 0169_invitation_organization also depend on 0167_add_organization. It adds a foreign key to Organization, and once 0168 stops depending on 0167_add_organization, nothing else makes that table exist first.
Decisions
  • Why change unstable's migrations, and not production's django_migrations table? It keeps the deploy free of manual steps.
Known gaps
  • Local databases last migrated on unstable before 0170_merge_20260717_0136 have unstable's 0168 applied without 0167_file_size_bigint_expand, so they raise InconsistentMigrationHistory after this change. Migrating them before pulling it, or resetting them, fixes that.
Acceptance Criteria
  • migrate succeeds on a database with production's history (0167_file_size_bigint_expand, 0168_alter_assessmentitem_type and 0169_file_size_bigint_swap applied)
  • migrate still succeeds on a database that is already on unstable's history through 0170_merge_20260717_0136
  • makemigrations --check reports no changes

AI usage

Claude found this while comparing the migrations on master, hotfixes and unstable, and drafted the issue, which I then checked and corrected for accuracy.

主要语言
Python
星标
212
派生
321
平均合并
1 天 7 小时
30 天内合并 PR
14

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

learningequality/studio 的其他 Issue

查看 learningequality/studio 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。