Skip to content

Commit 71e6a18

Browse files
authored
Merge pull request #340 from nanotaboada/docs/update-claude-md-flyway-migrations
docs(claude): document Flyway migrations in CLAUDE.md
2 parents a866013 + 67fb3ff commit 71e6a18

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ Release names follow the **historic football clubs** naming convention (A–Z):
4646

4747
### Changed
4848

49+
- Update `CLAUDE.md`: add Flyway to Tech Stack, add `db/migration/` to structure
50+
diagram, fix "Modify schema" workflow to use versioned Flyway migrations instead
51+
of manually editing the SQLite file — produced with the
52+
[CLAUDE.md Management plugin](https://claude.com/plugins/claude-md-management)
4953
- Consolidate project documentation into `CLAUDE.md` as the single source of
5054
truth; add Invariants and Architecture Decision Records sections; extend
5155
Pre-commit Checks with ADR update requirement (#335)

CLAUDE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ REST API for managing football players built with Java and Spring Boot. Implemen
1414
- **Validation**: Bean Validation (JSR-380)
1515
- **Caching**: Spring `@Cacheable` (simple in-memory, no expiry)
1616
- **Mapping**: ModelMapper
17+
- **Migrations**: Flyway (versioned SQL under `db/migration/`; disabled in tests — tests use Spring SQL init instead)
1718
- **Logging**: SLF4J
1819
- **Testing**: JUnit 5 + AssertJ + MockMvc + Mockito
1920
- **Coverage**: JaCoCo
@@ -31,9 +32,10 @@ src/main/java/
3132
├── models/ — Player entity + DTOs
3233
└── converters/ — JPA AttributeConverter for ISO-8601 date handling
3334
src/main/resources/ — application.properties, Logback config
35+
src/main/resources/db/migration/ — Flyway versioned SQL (V1 schema, V2+V3 seed data; add V{N}__ here to change schema)
3436
src/test/java/ — test classes mirroring main structure
35-
src/test/resources/ — test config, schema (ddl.sql), seed data (dml.sql)
36-
storage/ — SQLite database file (runtime)
37+
src/test/resources/ — test config, schema (ddl.sql), seed data (dml.sql); Flyway disabled in tests
38+
storage/ — SQLite database file (runtime, created and populated by Flyway on first start)
3739
```
3840

3941
**Layer rule**: `Controller → Service → Repository → JPA`. Controllers must not access repositories directly. Business logic must not live in controllers.
@@ -133,7 +135,7 @@ This project uses Spec-Driven Development (SDD): discuss in Plan mode first, cre
133135

134136
**Add an endpoint**: Define DTO in `models/` with Bean Validation → add service method in `services/` with `@Transactional` → create controller endpoint with `@Operation` annotation → add tests → run `./mvnw clean test jacoco:report`.
135137

136-
**Modify schema**: Update `@Entity` in `models/Player.java` → update DTOs if API changes → manually update `storage/players-sqlite3.db` (preserve 26 players) → update service, repository, and tests → run `./mvnw clean test`.
138+
**Modify schema**: Create a new Flyway migration `src/main/resources/db/migration/V{N}__description.sql` (production path) → update `@Entity` in `models/Player.java` → update DTOs if API changes → also update `src/test/resources/ddl.sql` and `dml.sql` (tests use Spring SQL init, not Flyway) → update service, repository, and tests → run `./mvnw clean test`. Do not manually edit the SQLite file in `storage/`; Flyway owns it.
137139

138140
**After completing work**: Suggest a branch name (e.g. `feat/add-player-stats`) and a commit message following Conventional Commits including co-author line:
139141

0 commit comments

Comments
 (0)