Skip to content

Commit 874be39

Browse files
committed
docs: updated order
1 parent 4e5eae6 commit 874be39

25 files changed

+182
-174
lines changed

.claude/settings.local.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"Bash(yarn start)",
1414
"Bash(PORT=3001 yarn start)",
1515
"Bash(sed:*)",
16-
"Bash(npm run build:*)"
16+
"Bash(npm run build:*)",
17+
"Bash(yarn build)",
18+
"Read(//Users/dieppa/workspace/flamingock/**)",
19+
"Bash(./gradlew:*)"
1720
],
1821
"deny": []
1922
}

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Flamingock works with two types of target systems:
190190
#### Transactional Target Systems
191191
- **Examples**: PostgreSQL, MySQL, MongoDB (4.0+), Oracle
192192
- **Native Capabilities**: Built-in rollback, atomicity, consistency guarantees
193-
- **In Flamingock**: Changes can leverage native transactions via `@ChangeUnit(transactional = true)`
193+
- **In Flamingock**: Changes can leverage native transactions via `@Change(transactional = true)`
194194
- **Rollback Strategy**: Automatic (database handles it) or manual via `@RollbackExecution`
195195

196196
#### Non-Transactional Target Systems

FLAMINGOCK_RECOVERY_SAFETY_KNOWLEDGE.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Before diving into recovery strategies, it's essential to understand Flamingock'
6565

6666
```java
6767
@TargetSystem("user-database") // This is the TARGET - where business changes go
68-
@ChangeUnit(id = "user-migration", order = "001", author = "team-data")
68+
@Change(id = "user-migration", order = "20250207_01", author = "team-data")
6969
public class UserMigration {
7070

7171
@Execution
@@ -115,7 +115,7 @@ Flamingock works with two types of target systems based on their native transact
115115
**Underlying Technology**: Systems that natively support ACID transactions
116116
- **Examples**: PostgreSQL, MySQL, MongoDB (4.0+), Oracle
117117
- **Native Capabilities**: Built-in rollback, atomicity, consistency guarantees
118-
- **In Flamingock**: Changes can leverage native transactions via `@ChangeUnit(transactional = true)`
118+
- **In Flamingock**: Changes can leverage native transactions via `@Change(transactional = true)`
119119
- **Rollback Strategy**: Automatic (database handles it) or manual via `@RollbackExecution` when the change itself it's not transactional, despite being a transactional target system(like DDL operations in MySQL,a s we mentioned)
120120

121121
#### Non-Transactional Target Systems
@@ -140,7 +140,7 @@ Even when targeting a transactional system, a change can be non-transactional.
140140

141141
```java
142142
// Transactional change - relies on database rollback
143-
@ChangeUnit(id = "user-migration", order = "001", transactional = true, author = "team")
143+
@Change(id = "user-migration", order = "20250207_01", transactional = true, author = "team")
144144
@TargetSystem("user-db")
145145
public class UserMigration {
146146

@@ -160,7 +160,7 @@ public class UserMigration {
160160

161161
// Non-transactional change - requires explicit rollback
162162
@TargetSystem("user-db")
163-
@ChangeUnit(id = "schema-changes", order = "002", transactional = false, author = "dba-team")
163+
@Change(id = "schema-changes", order = "20250207_02", transactional = false, author = "dba-team")
164164
public class SchemaChanges {
165165

166166
@Execution
@@ -218,7 +218,7 @@ Flamingock provides two recovery strategies that users can choose:
218218
**Example Configuration**:
219219
```java
220220
@TargetSystem("user-database")
221-
@ChangeUnit(id = "critical-user-migration", order = "001", author = "team-data")
221+
@Change(id = "critical-user-migration", order = "20250207_01", author = "team-data")
222222
// No @Recovery annotation needed - MANUAL_INTERVENTION is default
223223
public class CriticalUserMigration {
224224

@@ -274,7 +274,7 @@ public class CriticalUserMigration {
274274
**Example Configuration**:
275275
```java
276276
@TargetSystem("redis-cache")
277-
@ChangeUnit(id = "cache-warming", order = "002", author = "team-platform")
277+
@Change(id = "cache-warming", order = "20250207_02", author = "team-platform")
278278
@Recovery(strategy = RecoveryStrategy.ALWAYS_RETRY)
279279
public class CacheWarmingChange {
280280

@@ -312,7 +312,7 @@ public class CacheWarmingChange {
312312
```java
313313
// Event publishing - idempotent with same event key
314314
@TargetSystem("kafka-events")
315-
@ChangeUnit(id = "publish-user-events", order = "003", author = "team-events")
315+
@Change(id = "publish-user-events", order = "20250207_03", author = "team-events")
316316
@Recovery(strategy = RecoveryStrategy.ALWAYS_RETRY)
317317
public class PublishUserEvents {
318318

@@ -335,7 +335,7 @@ public class PublishUserEvents {
335335
}
336336

337337
// CREATE IF NOT EXISTS - naturally idempotent
338-
@ChangeUnit(id = "create-indexes", order = "004", author = "team-dba", transactional = false)
338+
@Change(id = "create-indexes", order = "20250207_04", author = "team-dba", transactional = false)
339339
@TargetSystem("user-database")
340340
@Recovery(strategy = RecoveryStrategy.ALWAYS_RETRY)
341341
public class CreateIndexes {
@@ -439,7 +439,7 @@ An "issue" is detected when:
439439
**Best Practice**: Use ALWAYS_RETRY
440440
```java
441441
@Recovery(strategy = RecoveryStrategy.ALWAYS_RETRY)
442-
@ChangeUnit(id = "publish-user-events", order = "003")
442+
@Change(id = "publish-user-events", order = "20250207_03")
443443
public class PublishUserEvents {
444444
@Execution
445445
public void publish(KafkaProducer producer) {
@@ -455,7 +455,7 @@ public class PublishUserEvents {
455455

456456
**Best Practice**: MANUAL_INTERVENTION for safety
457457
```java
458-
@ChangeUnit(id = "multi-system-update", order = "004")
458+
@Change(id = "multi-system-update", order = "20250207_04")
459459
// Default MANUAL_INTERVENTION ensures consistency
460460
public class MultiSystemUpdate {
461461
@Execution
@@ -651,7 +651,7 @@ public class CriticalDataMigration {
651651
Start with MANUAL_INTERVENTION, move to ALWAYS_RETRY after validation:
652652
```java
653653
// Phase 1: Manual intervention during initial rollout
654-
@ChangeUnit(id = "feature-v1", order = "001", author = "team-feature")
654+
@Change(id = "feature-v1", order = "20250207_01", author = "team-feature")
655655
public class FeatureRollout {
656656
@Execution
657657
public void rolloutFeature(FeatureService service) {
@@ -662,7 +662,7 @@ public class FeatureRollout {
662662
}
663663

664664
// Phase 2: After validation, same change with retry
665-
@ChangeUnit(id = "feature-v1-stable", order = "002", author = "team-feature")
665+
@Change(id = "feature-v1-stable", order = "20250207_02", author = "team-feature")
666666
@Recovery(strategy = RecoveryStrategy.ALWAYS_RETRY)
667667
public class FeatureRolloutStable {
668668
@Execution
@@ -677,7 +677,7 @@ public class FeatureRolloutStable {
677677
### Pattern 4: Transactional vs Non-Transactional Strategy
678678
```java
679679
// Large bulk operation - non-transactional for performance
680-
@ChangeUnit(id = "bulk-user-update", order = "005",
680+
@Change(id = "bulk-user-update", order = "20250207_05",
681681
author = "team-data", transactional = false)
682682
@TargetSystem("user-database")
683683
@Recovery(strategy = RecoveryStrategy.MANUAL_INTERVENTION)
@@ -714,7 +714,7 @@ public class BulkUserUpdate {
714714
}
715715

716716
// Small critical operation - transactional for safety
717-
@ChangeUnit(id = "admin-permissions", order = "006",
717+
@Change(id = "admin-permissions", order = "20250207_06",
718718
author = "team-security", transactional = true)
719719
@TargetSystem("user-database")
720720
@Recovery(strategy = RecoveryStrategy.MANUAL_INTERVENTION)

docs/changes/anatomy-and-structure.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Every Change must define these three properties:
1515
The `id` must be unique across all Changes in your application.
1616

1717
```java
18-
@Change(id = "add-user-status", order = "0001", author = "dev-team")
18+
@Change(id = "add-user-status", author = "dev-team") // order extracted from filename
1919
```
2020

2121
**Rules:**
@@ -28,14 +28,14 @@ ____
2828
The `order` determines when the Change executes relative to others.
2929

3030
```java
31-
@Change(id = "create-indexes", order = "0001", author = "dev-team")
32-
@Change(id = "migrate-data", order = "0002", author = "dev-team")
33-
@Change(id = "cleanup-temp-data", order = "0003", author = "dev-team")
31+
@Change(id = "create-indexes", order = "20250923_01", author = "dev-team")
32+
@Change(id = "migrate-data", order = "20250923_02", author = "dev-team")
33+
@Change(id = "cleanup-temp-data", order = "20250923_03", author = "dev-team")
3434
```
3535

3636
**Requirements:**
37-
- Must use zero-padded format: `0001`, `0002`, `0100`, etc.
38-
- Minimum 4 digits recommended for future expansion
37+
- Recommended format: `YYYYMMDD_NN` (e.g., `20250923_01`, `20250923_02`)
38+
- YYYY = year, MM = month, DD = day, NN = sequence number (01-99)
3939
- Determines execution order across all target systems
4040
- Cannot be changed once deployed
4141

@@ -48,8 +48,8 @@ The `order` determines when the Change executes relative to others.
4848
- For file/class names:
4949
- Must start with underscore `_`
5050
- Order is extracted between the first `_` and the last `_`
51-
- Allows intermediate underscores (e.g., `_2025_09_01_09_00_0001_CreateUserTable.java`)
52-
- Order extracted: everything between first and last underscore (e.g., `2025_09_01_09_00_0001`)
51+
- Recommended format: `YYYYMMDD_NN` (e.g., `_20250923_01_CreateUserTable.java`)
52+
- Order extracted: everything between first and last underscore (e.g., `20250923_01`)
5353
- Orders are evaluated in alphanumeric order
5454
:::
5555

@@ -59,8 +59,8 @@ ____
5959
Identifies who is responsible for this change.
6060

6161
```java
62-
@Change(id = "update-schema", order = "0001", author = "database-team")
63-
@Change(id = "migrate-users", order = "0002", author = "[email protected]")
62+
@Change(id = "update-schema", order = "20250923_01", author = "database-team")
63+
@Change(id = "migrate-users", order = "20250923_02", author = "[email protected]")
6464
```
6565

6666
**Best practices:**
@@ -76,7 +76,7 @@ Controls whether the change runs within a transaction (default: `true`).
7676
```java
7777
@Change(
7878
id = "create-large-index",
79-
order = "0001",
79+
order = "20250923_01",
8080
author = "db-team",
8181
transactional = false // DDL operations may require this
8282
)
@@ -95,14 +95,14 @@ Controls how Flamingock handles execution failures (default: `MANUAL_INTERVENTIO
9595

9696
```java
9797
// Default behavior (manual intervention)
98-
@Change(id = "critical-change", order = "0001", author = "team")
98+
@Change(id = "critical-change", order = "20250923_01", author = "team")
9999
public class CriticalChange {
100100
// Execution stops on failure, requires manual resolution
101101
}
102102

103103
// Automatic retry
104104
@Recovery(strategy = RecoveryStrategy.ALWAYS_RETRY)
105-
@Change(id = "idempotent-change", order = "0002", author = "team")
105+
@Change(id = "idempotent-change", order = "20250923_02", author = "team")
106106
public class IdempotentChange {
107107
// Automatically retries on failure until successful
108108
}
@@ -121,7 +121,7 @@ Briefly describes what the change does, especially useful for complex operations
121121
```java
122122
@Change(
123123
id = "optimize-user-queries",
124-
order = "0001",
124+
order = "20250923_01",
125125
author = "performance-team",
126126
description = "Add composite index on user table to improve search performance"
127127
)
@@ -134,8 +134,8 @@ Declares which target system this Change affects.
134134

135135
```java
136136
@TargetSystem("user-database")
137-
@Change(id = "add-user-fields", order = "0001", author = "api-team")
138-
public class _0001_AddUserFields {
137+
@Change(id = "add-user-fields", author = "api-team") // order extracted from filename
138+
public class _20250923_01_AddUserFields {
139139
// Implementation
140140
}
141141
```
@@ -147,7 +147,7 @@ Marks the class as a Change and contains all metadata.
147147
```java
148148
@Change(
149149
id = "migrate-user-data",
150-
order = "0001",
150+
order = "20250923_01",
151151
author = "migration-team",
152152
description = "Migrate legacy user format to new schema",
153153
transactional = true
@@ -216,20 +216,20 @@ For complete details on target system configuration vs change execution dependen
216216

217217
## File naming conventions
218218

219-
All Change files must follow the `_XXXX_DescriptiveName` pattern:
219+
All Change files must follow the `_ORDER_DescriptiveName` pattern, with recommended format `_YYYYMMDD_NN_DescriptiveName`:
220220

221221
```
222-
_0001_CreateUserIndexes.java
223-
_0002_MigrateUserData.java
224-
_0003_AddUserStatusColumn.yml
225-
_0100_OptimizeQueries.java
222+
_20250923_01_CreateUserIndexes.java
223+
_20250923_02_MigrateUserData.java
224+
_20250924_01_AddUserStatusColumn.yaml
225+
_20250925_01_OptimizeQueries.java
226226
```
227227

228228
**Rules:**
229-
- Start with underscore and zero-padded order
229+
- Start with underscore and order (recommended: YYYYMMDD_NN format)
230230
- Use PascalCase for descriptive names
231-
- Match the `order` property in the annotation
232-
- Applies to both code (.java/.kt/.groovy) and template (.yml/.json) files
231+
- Match the `order` property in the annotation if provided
232+
- Applies to both code (.java/.kt/.groovy) and template (.yaml/.json) files
233233

234234
## Complete example
235235

@@ -239,12 +239,12 @@ Here's a complete Change showing all elements:
239239
@TargetSystem("user-database")
240240
@Change(
241241
id = "add-user-preferences",
242-
order = "0001",
242+
order = "20250923_01",
243243
author = "user-experience-team",
244244
description = "Add preferences object to user documents with default values",
245245
transactional = true
246246
)
247-
public class _0001_AddUserPreferences {
247+
public class _20250923_01_AddUserPreferences {
248248

249249
@Apply
250250
public void apply(MongoDatabase database, ClientSession session) {

0 commit comments

Comments
 (0)