Skip to content
Back to skills

Flyway

ASecurity

Scaffold a Flyway migration SQL file with a build-enforced filename and PostgreSQL conventions. Use when a persistence change (entity/column/index) needs a migration — authored in the SAME change as the entity.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 19, 2026
ai-agentsgosqlexpress

Works with

  • cli

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned November 19, 2026

npx -y skills add ch4570/vulpora --skill flyway --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flyway?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Flyway
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ch4570-flyway/badge)](https://www.skillsdirectory.com/skills/ch4570-flyway)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: flyway
description: Scaffold a Flyway migration SQL file with a build-enforced filename and PostgreSQL conventions. Use when a persistence change (entity/column/index) needs a migration — authored in the SAME change as the entity.
---

# flyway — migration SQL scaffold

Generate a Flyway migration that satisfies the enforced filename grammar and the project's PostgreSQL
conventions. If the target repository has a path-scoped migration rule, apply it as an additional overlay
(the rule reminds; this skill scaffolds).

> **Authority**: the project's `AGENTS.md` (Flyway section) is binding when present. Risk-review
> destructive/locking changes with `postgres-risk-check`; schema design with `postgres-schema-design`.
> Deep reference: [`reference/principles.md`](reference/principles.md) and [`reference/kb/`](reference/kb/INDEX.md).

## Where it goes / filename (build-validated)
- Versioned migrations live under a single canonical migration directory (e.g. `flyway/migration/postgresql/common/`); environment subfolders (`ci/dev/local/`) hold env overrides only.
- Filename: **`V{yyyyMMdd.HHmmss}__{description}.sql`** where `{description}` matches `[A-Za-z0-9_]{1,50}`.
  House style: `V{ts}__{domain}__{action}_{entity}.sql` (e.g. `V20260428.110000__order__create_table_order.sql`). Repeatable: `R__{desc}.sql`.

## Skeleton
```sql
-- V20260623.140000__order__create_table_order.sql
CREATE TABLE IF NOT EXISTS "order"."order" (
    order_id   varchar(126) NOT NULL,
    status     varchar(50)  NOT NULL,
    created_at timestamptz  NOT NULL,
    updated_at timestamptz  NOT NULL,
    CONSTRAINT pk_order_order PRIMARY KEY (order_id)
);
COMMENT ON TABLE "order"."order" IS '주문';
CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_order_status ON "order"."order" (status);
```

## Rules (MUST)
- Schema-qualified table/index names; `CREATE TABLE/INDEX IF NOT EXISTS`. `CREATE INDEX CONCURRENTLY` is allowed (no transactional lock) — but it cannot run inside Flyway's transactional wrapper (see KB).
- Unique constraints are explicit and named `uq_<schema>_<t>_<cols>`. Dedup helpers can use an expression index (e.g. `md5(<expr>)`). Partial indexes use `... WHERE deleted = false`.
- Add `NOT NULL` in the safe 3 steps (add nullable → backfill in batches → set not null). Rich `COMMENT ON`. **No `CASCADE` drops.**

## Hard constraints (build fails / data risk)
- A filename violating the grammar fails the migration-file-name validation at build.
- An entity/column/index change MUST ship its migration in the **same** change ([`entity`](../entity/SKILL.md)).
- Large/locking changes (type change, `NOT NULL` on a big table, backfill) MUST go through `postgres-risk-check` first.

## Verify (build-system-agnostic)
Run Flyway info + validate via whatever build tool the project uses. Detect by lockfile/marker:

| Marker present | Flyway info | Flyway validate |
|---|---|---|
| `build.gradle`/`build.gradle.kts`/`gradlew` | `./gradlew flywayInfo` | `./gradlew flywayValidate` |
| `pom.xml` | `mvn flyway:info` | `mvn flyway:validate` |
| `package.json` (npm/pnpm/yarn) | `<pm> run flyway:info` (or `npx flyway info`) | `<pm> run flyway:validate` |
| standalone CLI | `flyway info` | `flyway validate` |

## Related
[`entity`](../entity/SKILL.md) · `postgres-risk-check` · `postgres-schema-design` · target-repository migration rules when present

Files in this skill

  • SKILL.md3.3 KB
  • reference/kb/INDEX.md1.6 KB
  • reference/kb/baseline-outoforder-sync.md2.3 KB
  • reference/kb/idempotency-patterns.md1.7 KB
  • reference/kb/naming-versioning.md1.6 KB
  • reference/kb/safe-migration-patterns.md1.9 KB
  • reference/kb/undo-limitations.md1.6 KB
  • reference/kb/versioned-vs-repeatable.md1.6 KB
  • reference/principles.md3.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.