Back to list
getsentry

generate-migration

by getsentry

Developer-first error tracking and performance monitoring

42,959🍴 4,579📅 Jan 23, 2026

Use Cases

Efficient Code Generation

Auto-generate boilerplate code to reduce development time.

🔍

Code Review Assistance

Analyze PR changes and suggest improvements.

🔧

Refactoring Suggestions

Suggest refactoring options to improve code quality.

SKILL.md


name: generate-migration description: Generate Django database migrations for Sentry. Use when creating migrations, adding/removing columns or tables, adding indexes, or resolving migration conflicts.

Generate Django Database Migrations

Commands

Generate migrations automatically based on model changes:

sentry django makemigrations

For a specific app:

sentry django makemigrations <app_name>

Generate an empty migration (for data migrations or custom work):

sentry django makemigrations <app_name> --empty

After Generating

  1. If you added a new model, ensure it's imported in the app's __init__.py
  2. Review the generated migration for correctness
  3. Run sentry django sqlmigrate <app_name> <migration_name> to verify the SQL

Guidelines

Adding Columns

  • Use db_default=<value> instead of default=<value> for columns with defaults
  • Nullable columns: use null=True
  • Not null columns: must have db_default set

Adding Indexes

For large tables, set is_post_deployment = True on the migration as index creation may exceed the 5s timeout.

Deleting Columns

  1. Make column nullable (null=True) if not already
  2. Remove all code references
  3. Replace RemoveField with SafeRemoveField(..., deletion_action=DeletionAction.MOVE_TO_PENDING)
  4. Deploy, then create second migration with SafeRemoveField(..., deletion_action=DeletionAction.DELETE)

Deleting Tables

  1. Remove all code references
  2. Replace DeleteModel with SafeDeleteModel(..., deletion_action=DeletionAction.MOVE_TO_PENDING)
  3. Deploy, then create second migration with SafeDeleteModel(..., deletion_action=DeletionAction.DELETE)

Renaming Columns/Tables

Don't rename in Postgres. Use db_column or Meta.db_table to keep the old name.

Resolving Merge Conflicts

If migrations_lockfile.txt conflicts:

bin/update-migration <migration_name>

This renames your migration, updates dependencies, and fixes the lockfile.

Score

Total Score

80/100

Based on repository quality metrics

SKILL.md

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

+20
LICENSE

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

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 1000以上

+15
最近の活動

1ヶ月以内に更新

+10
フォーク

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

+5
Issue管理

オープンIssueが50未満

0/5
言語

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

+5
タグ

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

+5

Reviews

💬

Reviews coming soon