db-migrate

star 27

Database migration management - Use Flyway and Atlas for version-controlled database schema migrations

y1feng200156 By y1feng200156 schedule Updated 2/10/2026

name: db-migrate description: Database migration management - Use Flyway and Atlas for version-controlled database schema migrations

Database Migration Skill

๐Ÿ“‹ Overview

Provides two modern database migration tools:

  • Flyway: Mature and stable, based on versioned SQL scripts
  • Atlas: Modern, declarative schema management

๐Ÿ”ง Prerequisites

Flyway

Tool Installation
Java 11+ adoptium.net
Flyway CLI Download

Atlas

Tool Windows Linux/Mac
Atlas scoop install atlas brew install ariga/tap/atlas

๐Ÿš€ Usage

Flyway Migration

Create migration script:

.\.agent\skills\db-migrate\scripts\flyway-create.ps1 -Name "add_users_table"
# Generates: V1__add_users_table.sql

Execute migration:

.\.agent\skills\db-migrate\scripts\flyway-migrate.ps1

Rollback migration:

.\.agent\skills\db-migrate\scripts\flyway-undo.ps1

Atlas Migration

Schema diff:

.\.agent\skills\db-migrate\scripts\atlas-diff.ps1

Auto-generate migration:

.\.agent\skills\db-migrate\scripts\atlas-migrate.ps1 -Auto

๐ŸŽฏ Features

Flyway

  • โœ… Versioned SQL migrations (V1__xxx.sql)
  • โœ… Repeatable migrations (R__xxx.sql)
  • โœ… Rollback support
  • โœ… Migration history tracking

Atlas

  • โœ… Declarative schema definition (HCL)
  • โœ… Auto-generated migration scripts
  • โœ… Visual schema diff
  • โœ… Linting and validation

๐Ÿ“Š Migration Script Examples

Flyway (V1__create_users.sql):

CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    username VARCHAR(50) UNIQUE NOT NULL,
    email VARCHAR(100) NOT NULL,
    created_at TIMESTAMP DEFAULT NOW()
);

CREATE INDEX idx_users_email ON users(email);

Atlas (schema.hcl):

table "users" {
  schema = schema.public
  column "id" {
    type = serial
  }
  column "username" {
    type = varchar(50)
    null = false
  }
  primary_key {
    columns = [column.id]
  }
  index "idx_users_email" {
    columns = [column.email]
  }
}

๐Ÿ”— Related Resources

Install via CLI
npx skills add https://github.com/y1feng200156/ham-study --skill db-migrate
Repository Details
star Stars 27
call_split Forks 5
navigation Branch main
article Path SKILL.md
More from Creator
y1feng200156
y1feng200156 Explore all skills →