db-migrate
Skill4 starsChanged 3 months agoMITView on GitHub
Alembic 迁移生成与执行
- Reads credentials
19 other projects use a version of this.
Adopted by
Most recently taken up by
- harmnot/trackfudtheir own version, first seen Nov 15, 2026
- suxrobGM/jobpilottheir own version, first seen Nov 7, 2026
- lablup/backend.aitheir own version, first seen Oct 8, 2026
- linuxfoundation/insightstheir own version, first seen Oct 8, 2026
- Ame-Al/ametheir own version, first seen Oct 8, 2026
- simstudioai/simtheir own version, first seen Oct 8, 2026
Used with
Projects with it also use react-query-best-practices, you-might-not-need-a-callback and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
bibektimilsina00Skillreact-query-best-practices
Audit and fix React Query usage in apps/web — enforce query key factories, signal forwarding, staleTime, and proper mutation patterns. Use when reviewing or fixing server-state code.
Also in 3 projects that use this
bibektimilsina00Skillyou-might-not-need-a-callback
Analyze and fix useCallback anti-patterns in your code
Also in 3 projects that use this
MicrosoftSkillcleanup
Also in 3 projects that use this
AWSSkillship
Finalize dev work on an issue branch — update docs, push, and open a PR.
Also in 7 projects that use this
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 3 projects that use this
MicrosoftSkillrelease
Use ONLY when the user explicitly asks to cut/publish a Huabu desktop release or tag a version. Performs an outward action — bumps the version in apps/desktop/package.json, commits + annotated-tags vX.Y.Z, and pushes the branch + tag. That tag push auto-builds the macOS/Windows installers and publishes a GitHub Release. Provides `status`, `bump`, `tag-push`, and a one-command `run` (bump → tag-push).
Also in 3 projects that use this
- +3 more from bibektimilsina00
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- simstudioai/sim★ 30ksame name
- lablup/backend.ai★ 681same name
- linuxfoundation/insights★ 292same name
- alexeykrol/claude-code-starter★ 194same name
- suxrobGM/jobpilot★ 113same name
- getsentry/abacus★ 77same name
- lfrodrigues/packt-claude-code-course-auth★ 9same name
- mgiovani/cc-arsenal★ 8same name
- mean-weasel/bullhorn★ 4same name
- vndee/engineering-skills★ 3same name
9 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Files
Database Migrate
规则摘要:.cursor/rules/db-migrate.mdc。命令一律用仓库根 .venv(见 .cursor/rules/agent-env.mdc)。
当前 head:s2f9c1a08e47(以 alembic heads / _alembic_head() 为准)。
1. 空库 / 升级
cd backend
../.venv/bin/alembic upgrade head开发空库 API 启动时 init_db() 会:PostgreSQL 先 alembic upgrade head,再 create_all + 补缺失列/索引/注释并 stamp head。已有库也依赖启动时 upgrade,但生产仍应显式 upgrade head。
DATABASE_URL 只来自 backend/.env(alembic/env.py 注入),勿写进 alembic.ini。
2. 模型变更 → 新 revision
cd backend
../.venv/bin/alembic revision --autogenerate -m "add xxx"
# 或 hand-written revision提交前清单(缺一项即不完整)
down_revision= 当前 head- 人工 review autogenerate(enum rename、列类型等常漏)
- 更新
tests/test_schema_baseline.py(新文件 +_alembic_head()断言) - 相关 model 测试列集合(如
test_project_model.py) ../.venv/bin/pytest tests/test_schema_baseline.py -q
3. 链结构(勿改 baseline)
c18a0e9b4d21 (baseline)
→ b7e4c2a19f08
→ e8c3a1b047d2 ─┬→ f3a9c2d18e04 (merge)
→ a1b8c3d049e4 ─┘
→ d4b7e1c08a92 → e7d2b4a10c95 → f8c2a1b03d14
→ g7b3e9a02c15 → h1c4d8e05f26 → i2d5f6a07b31 → j3e6a7b18c42
→ k4f7b8c29d53 → l5f8d2c31a70 → m6e0b3c42d81 → n7a1c4e53f92
→ o8b2d5c64a03 → p9c3e6d75b14 → q0d4f7e86c25 → r1e8a0b97d36
→ s2f9c1a08e47 (head)4. 回滚
../.venv/bin/alembic downgrade -1生产 downgrade / drop 需用户确认。
5. 允许 / 禁止
- 允许:DDL 增量;独立 revision 做小数据回填(如
openai_compat→custom)或列注释同步 - 禁止:改 baseline;migration 内调 Service;不可回滚的 destructive 变更未经确认
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

