スキル一覧に戻る
Bedriftsgrafen

database-migration

by Bedriftsgrafen

Full-stack business intelligence platform tracking 1.1M+ Norwegian companies with real-time analytics | React 19 | FastAPI | PostgreSQL

0🍴 0📅 2026年1月25日
GitHubで見るManusで実行

SKILL.md


name: Database Migration description: How to safely create, apply, and verify database migrations using Alembic.

Database Migration Skill

Purpose

Use this skill when modifying the database schema (Models) in backend/models/*.py. It ensures migrations are generated, inspected, and applied safely.

Workflow

1. Create Migration (Local)

  1. Modify the Model: Ensure your changes in backend/models/*.py are saved.
  2. Generate Migration: Run the following command:
    cd backend && .venv/bin/alembic revision --autogenerate -m "<describe_your_change>"
    
  3. Review the file:
    • Locate the new file in backend/alembic/versions/.
    • CRITICAL: Read the file to ensure it ONLY contains the intended changes. If it drops tables or columns unexpectedly, ABORT and investigate.

2. Apply Migration (Local)

  1. Upgrade Database:
    cd backend && .venv/bin/alembic upgrade head
    
  2. Verify:
    • Check if the changes are reflected in the database (e.g., table created, column added).
    • You can use psql or run a test script if needed.

3. Commit Strategy

Migrations should be their own atomic commit or grouped with the model change.

git add backend/alembic/versions/
git commit -m "chore(db): add migration for <feature>"

スコア

総合スコア

70/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です