用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/lukemcqueen/hermes-cortex --skill alembic-enum-double-create命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Cross-server agent health monitoring using binary status vectors — deploy health endpoints on each agent, poll from orchestrator, alert on state transitions.
Wire a self-hosted Langfuse instance to Hermes Agent — generate API keys, configure env vars, enable the bundled plugin, install SDK, and verify traces flow.
Use before enforcement code changes or shared-repo commits.
基于 SOC 职业分类
正在显示 SKILL.md
| name | alembic-enum-double-create |
| description | Use when alembic fails DuplicateObject enum on fresh DB. |
| version | 1.0.0 |
| category | software-development |
| platforms | ["linux","macos"] |
alembic upgrade head fails on a fresh/empty database (e.g. after Docker
volumes were deleted):
psycopg2.errors.DuplicateObject: type "notification_type" already exists
[SQL: CREATE TYPE notification_type AS ENUM (...)]
The api container crash-loops (health: starting forever), alembic_version
is stuck at an older revision, and web never starts (depends_on: api service_healthy). The same failure replays on every restart because
transactional DDL rolls the whole chain back.
The migration does BOTH:
sa.Enum(..., name="notification_type").create(op.get_bind())sa.Enum(..., name="notification_type", create_constraint=True)create_constraint=True makes SQLAlchemy emit CREATE TYPE again during
op.create_table (via Enum._on_table_create). Within one transaction the
type gets created twice → DuplicateObject. This only shows on a fresh DB;
an existing DB that already ran the migration never re-executes it, which is
why the bug can sit unnoticed.
Remove the explicit .create() calls. The column definitions create each
type exactly once during op.create_table:
def upgrade() -> None:
# Do NOT call sa.Enum(...).create() here — the column definitions below
# (create_constraint=True) emit CREATE TYPE during op.create_table.
# Double creation fails with DuplicateObject on a fresh DB.
op.create_table(
"notifications",
sa.Column("type", sa.Enum(..., name="notification_type", create_constraint=True), nullable=False),
...
)
Keep the downgrade dropping the types.
docker compose up -d).docker logs api | grep -E "Running upgrade|✓|✗" → all migrations run
through head, then ✓ Migrations up to date, uvicorn starts.alembic current reports the head revision.\dT+ shows the enum types exist exactly once.docker cp mode 600: copying a migration into a running container
lands with -rw------- owned by the host uid — the container user can't
read it → PermissionError on next start. Fix: docker exec -u root api chmod 644 /app/alembic/versions/<file>.py./app: if the Dockerfile COPYs the app (no volume mount for
code), docker cp is only a fast dev-loop test — rebuild the image so the
fix survives docker compose up / ./run up.alembic_version shows
the revision where the batch started (e.g. m10), not the failing one —
the whole batch rolled back.