Files
model-platform/migrations/versions
tao.chen 0ea6456ed1 cleanup: drop dead storage_objects.parent_object_id column + idx_storage_parent
parent_object_id was never written or read by any application code (verified
via repo-wide grep: only the baseline migration and the ORM model referenced
it). The orphan index idx_storage_parent likewise served nothing.

Tree structure is maintained entirely via the materialized path in
storage_objects.relative_path (LIKE-prefix queries in
backend/src/backend/scripts.py: list_workspace_tree, list_workspace_directories).
The column mislead a prior review into proposing an adjacency-list table —
removing it eliminates that temptation for the next reader.

Migration: migrations/versions/f7a8b9c0d1e2_drop_storage_parent.py
- Drops idx_storage_parent first, then parent_object_id (correct order on MySQL).
- MySQL 8.0 has no IF EXISTS on DROP INDEX / DROP COLUMN, so calls are unconditional.
- Updates the storage_objects TABLE COMMENT so the materialized-path warning
  reaches the DB, not just the ORM (Codex review finding).
- Downgrade restores both.

Model: common/src/common/db/models/storage.py
- Removes the dead Index entry and the dead column.
- Refreshes the table comment to flag the materialized-path contract.

Verified:
- alembic upgrade head: applied, head = f7a8b9c0d1e2
- SHOW INDEX / SHOW COLUMNS: 0 rows
- TABLE COMMENT updated in information_schema
- pytest backend/tests: 43 passed
2026-08-21 10:16:41 +08:00
..

Migration Revisions

该目录只保存经过评审和验证的 Alembic 迁移版本。

  • 已发布迁移不得直接修改。
  • 新迁移必须同时提供可执行的 upgrade()downgrade()
  • 自动生成后必须检查数据类型、约束、索引和执行顺序。

Migration Revisions

该目录只保存经过评审和验证的 Alembic 迁移版本。

Baseline

  • e1f2a3b4c5d6_rebuild_baseline.py — 2026-08-14 重建的基线迁移,包含完整 schema + seed。
  • 之前的 8 个迁移文件已合并并删除;新环境从此基线开始。

Rules

  • 已发布迁移不得直接修改。
  • 新迁移必须同时提供可执行的 upgrade()downgrade()
  • 自动生成后必须检查数据类型、约束、索引和执行顺序。