# Spring Jpa Flyway Postgres Integration

> Skill: spring-jpa-flyway-postgres-integration

- Skill: `carlnaddy/spring-jpa-flyway-postgres-integration` (Agent Skill)
- Install (CLI): `npx skillmds@latest add carlnaddy/spring-jpa-flyway-postgres-integration`
- Raw SKILL.md: https://api.skillmd.com/api/skills/carlnaddy/spring-jpa-flyway-postgres-integration/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: CarlNaddy (https://skillmd.com/u/carlnaddy)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/carlnaddy/spring-jpa-flyway-postgres-integration

---

# Skill: spring-jpa-flyway-postgres-integration

## Type
integration

## Selection Mode
secondary

## Requirements

- spring-data-jpa
- flyway-migrations
- postgresql-config

---

## Purpose

Define the persistence architecture for Spring applications using JPA + Flyway with PostgreSQL as production baseline.

---

## Architecture Rules

- Keep database schema lifecycle controlled by Flyway migrations.
- Use JPA repositories for aggregate access and service-layer transactions for write workflows.
- Separate profile-specific datasource behavior (local/test/prod) without changing domain contracts.
- Keep persistence changes coupled to migration artifacts in the same feature lifecycle.

---

## Integration Rules

- Any entity schema change must include Flyway migration changes.
- Production-like profiles run with PostgreSQL settings and non-auto schema generation.
- Feature acceptance criteria must include both functional behavior and migration validity.

---

## Defaults

- PostgreSQL is production/staging target.
- Flyway validates schema history during startup/CI.
- H2 is optional for local/test only and must not redefine production contracts.

---

## Anti-Patterns

- Do NOT let JPA auto-DDL drive production schema evolution.
- Do NOT ship schema changes without migration files.
- Do NOT mix inconsistent datasource behaviors across profiles without explicit policy.

