Skill Market

database migrations

PostgreSQL、MySQL、一般的なORM(Prisma、Drizzle、Kysely、Django、TypeORM、golang-migrate)全体のスキーマ変更、データマイグレーション、ロールバック、ゼロダウンタイムデプロイメントのためのデータベースマイグレーションベストプラクティス。

GitHub
githubcommunity
0.0
0 installs262.1K GitHub starsby affaan-m

Skill Introduction

Overview
PostgreSQL、MySQL、一般的なORM(Prisma、Drizzle、Kysely、Django、TypeORM、golang-migrate)全体のスキーマ変更、データマイグレーション、ロールバック、ゼロダウンタイムデプロイメントのためのデータベースマイグレーションベストプラクティス。

Core value

Turns reusable Other know-how into an installable skill, helping users complete github, community work faster.

Target users

  • Developers, testers, and maintainers who handle Other tasks in Focus Code.
  • Teams that already trust workflows or content from affaan-m.
  • Users who want standardized prompts, steps, or conventions instead of repeating setup work.

Best practices

  • Read the skill content first to confirm required inputs, expected outputs, and dependencies.
  • Try it on a small task before relying on it for critical work.
  • Add project-specific constraints such as coding style, target platform, test expectations, and delivery format.
  • For external sources, verify the source link, version, and recent maintenance activity.

Best use cases

  • Tasks related to github, community that need a reusable execution flow.
  • Converting a community repo, team convention, or personal workflow into day-to-day assistance.
  • Starting from a proven skill instead of writing prompts or procedures from scratch.

Limits and boundaries

  • Results depend on the quality of the original skill content and may need human correction.
  • It does not replace code review, tests, security review, or professional judgment.
  • External tools, APIs, account permissions, and local dependencies still need separate setup.

Differentiation

  • Structured around Other, making it easier to discover and reuse than loose prompt snippets.
  • Marked as GitHub, which helps users judge trust and maintenance expectations.
  • Keeps the original source link available for repository, documentation, or discussion follow-up.
  • Tagged with github, community, so it can be filtered by concrete task intent.

Install and use

Install
Copy Install Command
focus install database-migrations-ca5621
View source

Detail Preview

SKILL.md

Primary filemarkdown3 KB

name: database-migrations description: PostgreSQL、MySQL、一般的なORM(Prisma、Drizzle、Kysely、Django、TypeORM、golang-migrate)全体のスキーマ変更、データマイグレーション、ロールバック、ゼロダウンタイムデプロイメントのためのデータベースマイグレーションベストプラクティス。 origin: ECC

データベースマイグレーションパターン

本番環境システム用の安全で可逆的なデータベーススキーマ変更。

アクティベーション時期

  • データベーステーブルの作成または変更
  • 列またはインデックスの追加/削除
  • データマイグレーション(バックフィル、変換)の実行
  • ゼロダウンタイムスキーマ変更を計画
  • 新しいプロジェクト用のマイグレーションツール設定

コア原則

  1. すべての変更はマイグレーション — 本番環境データベースを手動で変更しない
  2. マイグレーションは本番環境で前方のみ — ロールバックは新しい前向きマイグレーション使用
  3. スキーマとデータマイグレーションは分離 — 1つのマイグレーションでDDLとDMLを混ぜない
  4. 本番環境サイズのデータに対してマイグレーションをテスト — 100行で機能するマイグレーション10M上でロックされる場合がある
  5. マイグレーションは展開後は不変 — 本番環境で実行されたマイグレーションを編集しない

マイグレーション安全チェックリスト

マイグレーションを適用する前に:

  • マイグレーションはUPとDOWNの両方を持つ(または明示的に不可逆としてマーク)
  • 大型テーブルの完全テーブルロックなし(並行操作使用)
  • 新しい列はデフォルトまたはnullable(デフォルトなしでNOT NULLを追加しない)
  • インデックスは並行して作成(既存テーブルのCREATE TABLEでインライン化しない)
  • データバックフィルはスキーマ変更から分離したマイグレーション
  • 本番環境データのコピーに対してテスト
  • ロールバック計画を文書化

PostgreSQL パターン

列を安全に追加

-- GOOD: Nullable列、ロックなし
ALTER TABLE users ADD COLUMN avatar_url TEXT;

-- GOOD: デフォルト付きの列(Postgres 11+は即座、書き直しなし)
ALTER TABLE users ADD COLUMN is_active BOOLEAN NOT NULL DEFAULT true;

-- BAD: 既存テーブルのデフォルトなしで NOT NULL(完全書き直し必須)
ALTER TABLE users ADD COLUMN is_active BOOLEAN NOT NULL;

詳細についてはドキュメントを参照してください。

Reviews

Overall rating

0.0
0.0

0 comments

No reviews yet