Skip to content

fix(db): 删除按团队存储的依赖目录旧表 - #1748

Merged
HoneyBBQ merged 1 commit into
fix/dependency-catalog-globalfrom
fix/dependency-catalog-drop-team-tables
Nov 5, 2026
Merged

HoneyBBQ merged 1 commit into
fix/dependency-catalog-globalfrom
fix/dependency-catalog-drop-team-tables

Conversation

@HoneyBBQ

@HoneyBBQ HoneyBBQ commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Author

  • Human
  • Agent

Type

  • bug
  • feat
  • test

Summary

问题

#1747 把依赖定义和依赖目录移到 template schema 下的全局表。按团队的旧表 public.workspace_dependency_definitions 和 public.workspace_dependency_catalogs 仍然保留,供滚动发布期间仍在运行的上一版本使用。发布窗口内,上一版本取到的新定义只会写进旧表。

改动

  • 新迁移 0174 先把旧表里已校验、全局表还没有的定义补拷过去。校验和去重规则与 0173 相同,冲突时跳过。
  • 补拷之后删除两张旧表。目录不再合并,由后台刷新从 Supermarket 重建。
  • down 按原结构重建两张空表,包括 team_id、last_accessed_at、索引、FORCE RLS 和策略,不恢复数据。
  • 0001_init 更新为删除旧表后的状态。

本 PR 需要在 #1747 部署完成后再合并。

Related Issues

Refs #1744

Validation

  • go build ./... 通过。./internal/db/...、./internal/workspacedeps/... 的单元测试和集成测试通过,包括 schema 守卫测试。mise run lint:go 通过。
  • 迁移集成测试步骤:
    • 在 0173 时只往旧表写入一条校验通过的定义和一条哈希不符的定义。
    • 升到 0174 后,前者出现在全局表,后者没有,两张旧表已删除。
    • 降回 0173,两张旧表存在且开启 FORCE RLS,策略齐全。
    • 再次升级。

Screenshots / Recordings

不涉及界面,只有数据库迁移。验证方式见上方迁移集成测试。

Human QA

  • Human QA passed

Migration 0174 copies verified definitions that Servers still on the previous
release wrote into public.workspace_dependency_definitions into the global
template table, then drops the per-team definition and catalog tables. The
catalog is rebuilt by the refresher. 0001_init reflects the final state.

Must be deployed only after 0173 and after no previous-release Server runs.

Refs #1744
@github-actions github-actions Bot added bug Fixes a bug or unexpected behavior change:migrations Adds, modifies, or removes database migrations change:server Changes backend code, configuration, or API contracts size:S PR size uses the larger of added or deleted lines, excluding generated files labels Nov 5, 2026
@HoneyBBQ
HoneyBBQ merged commit 62f7c3c into fix/dependency-catalog-global Nov 5, 2026
2 checks passed
@HoneyBBQ

HoneyBBQ commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

本 PR 的提交已并入 #1747 的分支,所以 GitHub 显示为已合并。它没有进入 main,后续在 #1747 里一起评审。

@HoneyBBQ
HoneyBBQ deleted the fix/dependency-catalog-drop-team-tables branch November 5, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes a bug or unexpected behavior change:migrations Adds, modifies, or removes database migrations change:server Changes backend code, configuration, or API contracts size:S PR size uses the larger of added or deleted lines, excluding generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant