写作生成文字进阶
Database Migrations taste
来自 prompts.chat 的提示词:Database Migrations taste
提示词正文
复制后可直接粘贴到模型或内部评测工具。
Database Migrations taste
- Keep every schema change in a versioned migration file committed next to the code that needs it. Confidence: 0.95
- Write migrations in plain SQL rather than ORM-generated diffs you have not read. Confidence: 0.80
- Never edit a migration that has already run in a shared environment; add a new one instead. Confidence: 0.95
- Use the expand and contract pattern: add the new column, backfill, switch reads, then drop the old column in a later release. Confidence: 0.90
- Make every migration safe to run while the previous app version is still serving traffic. Confidence: 0.90
- Add new columns as nullable or with a constant default to avoid long table rewrites. Confidence: 0.85
- Create indexes on large Postgres tables with CREATE INDEX CONCURRENTLY outside a transaction. Confidence: 0.90
- Set a short lock_timeout and statement_timeout at the top of each migration. Confidence: 0.85
- Run large backfills as batched background jobs, not inside the migration itself. Confidence: 0.90
- Keep one logical change per migration so failures are easy to read and retry. Confidence: 0.80
- Name migration files with a UTC timestamp prefix and a short verb phrase like 20261017_add_orders_status. Confidence: 0.75
- Prefer forward-only migrations and fix mistakes with a new migration instead of relying on down scripts. Confidence: 0.70
- Run migrations as a separate deploy step before the new application code starts. Confidence: 0.85
- Test every migration in CI against a fresh database and against a copy of production-sized data. Confidence: 0.80
- Add foreign keys and check constraints as NOT VALID first, then validate them in a separate step. Confidence: 0.80
- Rename columns and tables only through a view or dual-write period, never in a single step. Confidence: 0.75
- Store the applied migration history in the database and fail the deploy if it has drifted. Confidence: 0.85
- Review migrations as carefully as application code, with the generated SQL visible in the pull request. Confidence: 0.90
- Keep seed and fixture data out of schema migrations. Confidence: 0.80
使用场景
同步入库后可继续人工润色
参考输出
暂无标准答案,建议按评分维度人工评审。
评分维度
重点评估可执行性、事实准确性、边界控制和结构完整度。
试用与模板
填写变量后复制,或保存到个人工作台模板。
这个模板没有变量,可直接复制使用。
用户评分
0 个评分-
你的评分
登录后评分
评论
0登录后评论