Skip to content

Commit 751ea19

Browse files
jlc488claude
andcommitted
v0.2.0: Make schema management opt-in
Schema management for the api_log table is now opt-in via api.log.schema.management (default: NONE). Previously the starter force-installed Flyway and auto-applied the bundled migration, which broke consumers who: - already had the table managed elsewhere (Liquibase, manual DDL), - had a name collision in classpath:db/migration/, - didn't want Flyway at all. Changes: - ApiLogProperties.Schema.Management enum (NONE, FLYWAY) under api.log.schema.management - ApiLogFlywayConfig: registers a FlywayConfigurationCustomizer when schema.management=flyway and Flyway is on the classpath; appends classpath:db/api-log to spring.flyway.locations (additive, doesn't replace). - pom.xml: flyway-core / flyway-database-postgresql now <optional>true</optional> - Migration relocated: classpath:db/migration/ → classpath:db/api-log/ - Tests opt in via src/test/resources/application.properties Docs updated: - Installation: explains the NONE | FLYWAY choice and the optional Flyway dep - Quickstart: explicitly sets schema.management=flyway with Flyway dep instructions - Configuration reference: new property documented - Schema reference: clarifies "not auto-created by default" - Changelog: 0.2.0 entry with v0.1.0 migration guide Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 417c638 commit 751ea19

18 files changed

Lines changed: 426 additions & 115 deletions

CHANGELOG.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,22 @@ The source of truth for the entries below is [docs/changelog.md](docs/changelog.
77

88
## [Unreleased]
99

10-
### Changed
11-
12-
- **Restructured as standalone Spring Boot Starter library.**
13-
- `groupId`: `com.devs.lab``kr.devslab`
14-
- `artifactId`: `api-log-starter``api-log-spring-boot-starter`
15-
- Java package: `com.devs.lab.test.*``kr.devslab.apilog.*`
16-
- Removed demo application (`ApiLogApplication`, `compose.yaml`, `Dockerfile.postgres`) — pure library now
17-
- Removed app-only dependencies: `spring-boot-devtools`, `spring-boot-docker-compose`, `spring-boot-starter-actuator`
10+
## [0.2.0] — Schema management opt-in
1811

19-
### Fixed
20-
21-
- Flyway migration path: `db.migration/``db/migration/` (the dot version wasn't a standard Flyway location and never auto-applied)
12+
### Changed
2213

23-
### Added
14+
- **BREAKING: schema management is now opt-in.** v0.1.0 force-installed Flyway and auto-ran the bundled migration. v0.2.0 makes the consumer choose:
15+
- `api.log.schema.management=none` (default) — apply the DDL yourself
16+
- `api.log.schema.management=flyway` — starter customizes Flyway to include its location
17+
- `flyway-core` / `flyway-database-postgresql` now `<optional>true</optional>` — consumers using `management=flyway` must declare Flyway themselves.
18+
- Migration moved: `classpath:db/migration/``classpath:db/api-log/` (avoids collision with consumer's default Flyway location).
2419

25-
- `LICENSE` (Apache 2.0) + `NOTICE`
26-
- Full `pom.xml` metadata for Maven Central publishing
27-
- Bilingual README (English default + `README.ko.md`)
28-
- Full documentation site at [api-log.devslab.kr](https://api-log.devslab.kr)
20+
See [docs/changelog.md](docs/changelog.md#020--schema-management-opt-in) for the full migration guide from v0.1.0.
2921

3022
## [0.1.0] — Initial release
3123

3224
First public release. See [docs/changelog.md](docs/changelog.md#010--initial-release) for details.
3325

34-
[Unreleased]: https://github.com/devslab-kr/api-log/compare/v0.1.0...HEAD
26+
[Unreleased]: https://github.com/devslab-kr/api-log/compare/v0.2.0...HEAD
27+
[0.2.0]: https://github.com/devslab-kr/api-log/releases/tag/v0.2.0
3528
[0.1.0]: https://github.com/devslab-kr/api-log/releases/tag/v0.1.0

README.ko.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ CompletableFuture<ApiResponse> future = restApiClient.postAsync("/api/users", us
165165
<dependency>
166166
<groupId>kr.devslab</groupId>
167167
<artifactId>api-log-spring-boot-starter</artifactId>
168-
<version>0.1.0-SNAPSHOT</version>
168+
<version>0.2.0</version>
169169
</dependency>
170170
```
171171

@@ -222,11 +222,26 @@ spring:
222222
threads:
223223
virtual:
224224
enabled: true # 권장 (Java 21+)
225+
226+
api:
227+
log:
228+
enabled: true # 기본값 — false면 전체 인프라 비활성화
229+
schema:
230+
management: none # 기본값 — 아래 "스키마 관리" 참고
225231
```
226232
227233
- **PostgreSQL DataSource** (JSONB 컬럼 사용 위해 필수)
228234
- **ObjectMapper** Bean (Spring Boot 기본 구성으로 충분)
229-
- 스타터에 포함된 Flyway 마이그레이션 `V1.0__create_api_log.sql`이 자동 적용됨
235+
- `api_log` 테이블 생성 방법 — DDL을 직접 적용하거나, 번들 Flyway 마이그레이션을 옵트인
236+
237+
### 스키마 관리 (v0.2.0 변경)
238+
239+
`api_log` 테이블은 **자동으로 생성되지 않습니다.** 두 가지 옵션:
240+
241+
1. **DDL 직접 적용** (기본값, 운영 권장) — [스키마 레퍼런스](https://api-log.devslab.kr/ko/reference/schema/) 참고. 본인 Flyway/Liquibase/수동 흐름에 SQL을 넣으세요.
242+
2. **번들 마이그레이션 옵트인** — Flyway 의존성 추가 + `api.log.schema.management=flyway`. 스타터가 `spring.flyway.locations`에 `classpath:db/api-log` 추가.
243+
244+
전체 설치 가이드: [api-log.devslab.kr/ko/getting-started/installation](https://api-log.devslab.kr/ko/getting-started/installation/).
230245

231246
## 🧪 테스트
232247

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,40 @@ PostgreSQL (api_log · JSONB columns)
7373
<dependency>
7474
<groupId>kr.devslab</groupId>
7575
<artifactId>api-log-spring-boot-starter</artifactId>
76-
<version>0.1.0-SNAPSHOT</version>
76+
<version>0.2.0</version>
7777
</dependency>
7878
```
7979

8080
### Gradle
8181

8282
```kotlin
83-
implementation("kr.devslab:api-log-spring-boot-starter:0.1.0-SNAPSHOT")
83+
implementation("kr.devslab:api-log-spring-boot-starter:0.2.0")
8484
```
8585

8686
## Configuration
8787

8888
```yaml
8989
api:
9090
log:
91-
enabled: true # default: true
91+
enabled: true # default — set to false to disable the whole infrastructure
92+
schema:
93+
management: none # default — see "Schema" below
9294
```
9395
9496
You bring your own:
9597
9698
- `DataSource` pointing at a PostgreSQL database
9799
- `ObjectMapper` bean (Spring Boot's auto-config is fine)
100+
- Either the `api_log` table created via your own migration tool, OR the bundled Flyway migration (opt in below)
98101

99-
The Flyway migration `V1.0__create_api_log.sql` ships with the starter — Spring Boot will pick it up if Flyway is on the classpath.
102+
### Schema
103+
104+
The `api_log` table is **not** created automatically. Two options:
105+
106+
1. **Apply the DDL yourself** (default, recommended for production) — see the [Schema reference](https://api-log.devslab.kr/reference/schema/) for the SQL, then put it in your own Flyway/Liquibase/manual flow.
107+
2. **Opt in to the bundled migration** — add Flyway to your dependencies and set `api.log.schema.management=flyway`. The starter then appends `classpath:db/api-log` to your Flyway locations.
108+
109+
Full installation guide: [api-log.devslab.kr/getting-started/installation](https://api-log.devslab.kr/getting-started/installation/).
100110

101111
## Using `RestApiClientUtil`
102112

docs/changelog.ko.md

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,62 @@
66

77
## [Unreleased]
88

9+
## [0.2.0] — 스키마 관리 옵트인
10+
11+
### Changed
12+
13+
- **BREAKING: 스키마 관리가 옵트인 방식으로 변경.** v0.1.0은 Flyway를 강제로 깔고 번들 마이그레이션을 자동 실행했습니다. v0.2.0부터는 사용자가 선택:
14+
- `api.log.schema.management=none` (기본) — DDL 직접 적용 (Liquibase, 수동 `psql`, 자체 Flyway 흐름)
15+
- `api.log.schema.management=flyway` — 스타터가 `FlywayConfigurationCustomizer`를 등록해 자기 마이그레이션 위치를 Flyway에 추가
16+
- `flyway-core`, `flyway-database-postgresql``<optional>true</optional>`로 변경 — `management=flyway` 쓰는 사용자가 직접 Flyway 의존성 추가 필요.
17+
- 마이그레이션 위치 이동: `classpath:db/migration/V1.0__create_api_log.sql``classpath:db/api-log/V1.0__create_api_log.sql` (사용자 기본 Flyway 위치와 충돌 방지).
18+
19+
### v0.1.0에서 마이그레이션
20+
21+
v0.1.0의 자동 마이그레이션에 의존하고 있었다면:
22+
23+
1. `org.flywaydb:flyway-core` (+ runtime의 `flyway-database-postgresql`)를 본인 의존성에 추가.
24+
2. 설정에 `api.log.schema.management=flyway` 추가.
25+
26+
스키마를 직접 적용하고 싶다면 (운영 환경 권장):
27+
28+
1. [스키마 레퍼런스](reference/schema.md)의 SQL을 본인 마이그레이션 도구에 복사.
29+
2. `api.log.schema.management`는 기본값(`none`) 그대로.
30+
31+
## [0.1.0] — 첫 공개
32+
33+
첫 공개 릴리스. 독립 Spring Boot starter로 재패키징.
34+
935
### Changed
1036

1137
- **독립 Spring Boot Starter 라이브러리로 재구성.**
1238
- `groupId`: `com.devs.lab``kr.devslab`
1339
- `artifactId`: `api-log-starter``api-log-spring-boot-starter`
1440
- Java 패키지: `com.devs.lab.test.*``kr.devslab.apilog.*`
15-
- 데모 애플리케이션 제거 (`ApiLogApplication`, `compose.yaml`, `Dockerfile.postgres`) — 순수 라이브러리
16-
- 앱 전용 의존성 제거: `spring-boot-devtools`, `spring-boot-docker-compose`, `spring-boot-starter-actuator`
17-
- 빌드에서 `spring-boot-maven-plugin` 제거 (라이브러리, 실행 jar 아님)
41+
- 데모 애플리케이션 제거 (`ApiLogApplication`, `compose.yaml`, `Dockerfile.postgres`) — 순수 라이브러리.
42+
- 앱 전용 의존성 제거: `spring-boot-devtools`, `spring-boot-docker-compose`, `spring-boot-starter-actuator`.
43+
- 빌드에서 `spring-boot-maven-plugin` 제거 (라이브러리, 실행 jar 아님).
1844

1945
### Fixed
2046

21-
- Flyway 마이그레이션 경로: `db.migration/``db/migration/` (점 버전은 표준 Flyway 위치가 아니라 자동 적용되지 않았음)
47+
- Flyway 마이그레이션 경로: `db.migration/``db/migration/` (점 버전은 표준 Flyway 위치가 아니라 자동 적용되지 않았음).
2248

2349
### Added
2450

25-
- `LICENSE` (Apache 2.0) + `NOTICE`
26-
- Maven Central 발행에 필요한 `pom.xml` 메타데이터 (licenses, SCM, developers, organization)
27-
- 양국어 README (영문 기본 + `README.ko.md`)
28-
- 본 문서 사이트
29-
30-
## [0.1.0] — 첫 공개
31-
32-
첫 공개 릴리스. 독립 Spring Boot starter로 재패키징.
51+
- `LICENSE` (Apache 2.0) + `NOTICE`.
52+
- Maven Central 발행에 필요한 `pom.xml` 메타데이터 (licenses, SCM, developers, organization).
53+
- 양국어 README (영문 기본 + `README.ko.md`).
54+
- 본 문서 사이트.
3355

3456
### 하이라이트
3557

36-
- `ApplicationEventPublisher`를 통한 비동기, 이벤트 드리븐 API 호출 로깅
37-
- `RestApiClientUtil` 내장 HTTP 클라이언트 — `GET` / `POST` × `sync` / `async` × `raw` / `typed`
38-
- 요청/응답/에러 본문의 PostgreSQL JSONB 저장
39-
- Spring Retry 통합과 `RETRY_ERROR` 이벤트
40-
- `ApiLogAutoConfiguration`을 통한 자동 구성, `@ConditionalOnMissingBean` 오버라이드
41-
- Testcontainers 기반 PostgreSQL 통합 테스트 31개
58+
- `ApplicationEventPublisher`를 통한 비동기, 이벤트 드리븐 API 호출 로깅.
59+
- `RestApiClientUtil` 내장 HTTP 클라이언트 — `GET` / `POST` × `sync` / `async` × `raw` / `typed`.
60+
- 요청/응답/에러 본문의 PostgreSQL JSONB 저장.
61+
- Spring Retry 통합과 `RETRY_ERROR` 이벤트.
62+
- `ApiLogAutoConfiguration`을 통한 자동 구성, `@ConditionalOnMissingBean` 오버라이드.
63+
- Testcontainers 기반 PostgreSQL 통합 테스트 31개.
4264

43-
[Unreleased]: https://github.com/devslab-kr/api-log/compare/v0.1.0...HEAD
65+
[Unreleased]: https://github.com/devslab-kr/api-log/compare/v0.2.0...HEAD
66+
[0.2.0]: https://github.com/devslab-kr/api-log/releases/tag/v0.2.0
4467
[0.1.0]: https://github.com/devslab-kr/api-log/releases/tag/v0.1.0

docs/changelog.md

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,62 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
66

77
## [Unreleased]
88

9+
## [0.2.0] — Schema management opt-in
10+
11+
### Changed
12+
13+
- **BREAKING: schema management is now opt-in.** v0.1.0 force-installed Flyway and auto-ran the bundled migration. v0.2.0 makes the consumer choose:
14+
- `api.log.schema.management=none` (default) — apply the DDL yourself (Liquibase, manual `psql`, your own Flyway flow)
15+
- `api.log.schema.management=flyway` — starter registers a `FlywayConfigurationCustomizer` that adds its location to your Flyway setup
16+
- `flyway-core` and `flyway-database-postgresql` are now `<optional>true</optional>` — consumers who want `management=flyway` must declare Flyway in their own build.
17+
- Migration relocated from `classpath:db/migration/V1.0__create_api_log.sql` to `classpath:db/api-log/V1.0__create_api_log.sql` so it no longer collides with the consumer's default Flyway location.
18+
19+
### Migration guide (from v0.1.0)
20+
21+
If you were depending on v0.1.0's auto-migration:
22+
23+
1. Add `org.flywaydb:flyway-core` (and `flyway-database-postgresql` runtime) to your dependencies.
24+
2. Set `api.log.schema.management=flyway` in your config.
25+
26+
If you'd rather apply the schema yourself (recommended for production):
27+
28+
1. Copy the SQL from [Schema reference](reference/schema.md) into your migration tool of choice.
29+
2. Leave `api.log.schema.management` at its default (`none`).
30+
31+
## [0.1.0] — Initial release
32+
33+
First public release. Repackaged as a standalone Spring Boot starter.
34+
935
### Changed
1036

1137
- **Restructured as standalone Spring Boot Starter library.**
1238
- `groupId`: `com.devs.lab``kr.devslab`
1339
- `artifactId`: `api-log-starter``api-log-spring-boot-starter`
1440
- Java package: `com.devs.lab.test.*``kr.devslab.apilog.*`
15-
- Removed demo application (`ApiLogApplication`, `compose.yaml`, `Dockerfile.postgres`) — pure library now
16-
- Removed app-only dependencies: `spring-boot-devtools`, `spring-boot-docker-compose`, `spring-boot-starter-actuator`
17-
- Removed `spring-boot-maven-plugin` from build (library, not executable jar)
41+
- Removed demo application (`ApiLogApplication`, `compose.yaml`, `Dockerfile.postgres`) — pure library.
42+
- Removed app-only dependencies: `spring-boot-devtools`, `spring-boot-docker-compose`, `spring-boot-starter-actuator`.
43+
- Removed `spring-boot-maven-plugin` from build (library, not executable jar).
1844

1945
### Fixed
2046

21-
- Flyway migration path: `db.migration/``db/migration/` (the dot version wasn't a standard Flyway location and never auto-applied)
47+
- Flyway migration path: `db.migration/``db/migration/` (the dot version wasn't a standard Flyway location and never auto-applied).
2248

2349
### Added
2450

25-
- `LICENSE` (Apache 2.0) + `NOTICE`
26-
- Full `pom.xml` metadata (licenses, SCM, developers, organization) required for Maven Central publishing
27-
- Bilingual README (English default + `README.ko.md`)
28-
- This documentation site
29-
30-
## [0.1.0] — Initial release
31-
32-
First public release. Repackaged as a standalone Spring Boot starter.
51+
- `LICENSE` (Apache 2.0) + `NOTICE`.
52+
- Full `pom.xml` metadata (licenses, SCM, developers, organization) required for Maven Central publishing.
53+
- Bilingual README (English default + `README.ko.md`).
54+
- This documentation site.
3355

3456
### Highlights
3557

36-
- Async, event-driven API call logging via `ApplicationEventPublisher`
37-
- `RestApiClientUtil` bundled HTTP client with `GET` / `POST` × `sync` / `async` × `raw` / `typed`
38-
- PostgreSQL JSONB storage for request/response/error bodies
39-
- Spring Retry integration with `RETRY_ERROR` events
40-
- Auto-configuration via `ApiLogAutoConfiguration` with `@ConditionalOnMissingBean` overrides
41-
- 31 tests including PostgreSQL integration via Testcontainers
58+
- Async, event-driven API call logging via `ApplicationEventPublisher`.
59+
- `RestApiClientUtil` bundled HTTP client with `GET` / `POST` × `sync` / `async` × `raw` / `typed`.
60+
- PostgreSQL JSONB storage for request/response/error bodies.
61+
- Spring Retry integration with `RETRY_ERROR` events.
62+
- Auto-configuration via `ApiLogAutoConfiguration` with `@ConditionalOnMissingBean` overrides.
63+
- 31 tests including PostgreSQL integration via Testcontainers.
4264

43-
[Unreleased]: https://github.com/devslab-kr/api-log/compare/v0.1.0...HEAD
65+
[Unreleased]: https://github.com/devslab-kr/api-log/compare/v0.2.0...HEAD
66+
[0.2.0]: https://github.com/devslab-kr/api-log/releases/tag/v0.2.0
4467
[0.1.0]: https://github.com/devslab-kr/api-log/releases/tag/v0.1.0

0 commit comments

Comments
 (0)