Skip to content

Commit c20b2f1

Browse files
committed
docs: fixed order (2nd phase)
1 parent e2d9f32 commit c20b2f1

20 files changed

+95
-884
lines changed

.claude/settings.local.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@
1717
"Bash(yarn build)",
1818
"Read(//Users/dieppa/workspace/flamingock/**)",
1919
"Bash(./gradlew:*)",
20-
"Bash(sort:*)"
20+
"Bash(sort:*)",
21+
"Bash(docs/overview/Change-as-Code.md)",
22+
"Bash({} ;)",
23+
"Bash(docs/flamingock-library-config/setup-and-stages.md)",
24+
"Bash(docs/changes/domain-coupling.md)",
25+
"Bash(docs/changes/introduction.md)",
26+
"Bash(docs/target-systems/sql-target-system.md)",
27+
"Bash(docs/changes/types-and-implementation.md)",
28+
"Bash(docs/target-systems/mongodb-springdata-target-system.md)",
29+
"Bash(docs/changes/best-practices.md)",
30+
"Bash(docs/target-systems/dynamodb-target-system.md)",
31+
"Bash(docs/target-systems/couchbase-target-system.md)",
32+
"Bash(docs/target-systems/mongodb-target-system.md)"
2133
],
2234
"deny": []
2335
}

FLAMINGOCK_RECOVERY_SAFETY_KNOWLEDGE.md

Lines changed: 0 additions & 790 deletions
This file was deleted.

docs/changes/best-practices.md

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Once a Change is deployed, never modify it. Create new Changes for corrections.
1717
```java
1818
// Modifying an existing Change after deployment
1919
@Change(id = "add-user-field", author = "team") // order extracted from filename
20-
public class _20250923_01_AddUserField {
20+
public class _0001__AddUserField {
2121
@Apply
2222
public void apply(MongoDatabase db) {
2323
// Original: db.getCollection("users").updateMany(/* add field */)
@@ -30,7 +30,7 @@ public class _20250923_01_AddUserField {
3030
```java
3131
// Keep the original unchanged
3232
@Change(id = "add-user-field", author = "team") // order extracted from filename
33-
public class _20250923_01_AddUserField {
33+
public class _0001__AddUserField {
3434
@Apply
3535
public void apply(MongoDatabase db) {
3636
// Original logic remains unchanged
@@ -39,7 +39,7 @@ public class _20250923_01_AddUserField {
3939

4040
// Create a new Change for corrections
4141
@Change(id = "fix-user-field-values", author = "team") // order extracted from filename
42-
public class _20250923_02_FixUserFieldValues {
42+
public class _0002__FixUserFieldValues {
4343
@Apply
4444
public void apply(MongoDatabase db) {
4545
// Correction logic
@@ -83,7 +83,7 @@ Every Change must have a `@Rollback` method, regardless of target system type.
8383
**Example with comprehensive rollback:**
8484
```java
8585
@Change(id = "setup-user-indexes", author = "db-team") // order extracted from filename
86-
public class _20250923_01_SetupUserIndexes {
86+
public class _0001__SetupUserIndexes {
8787

8888
@Apply
8989
public void apply(MongoDatabase database) {
@@ -127,7 +127,7 @@ Each Change should address one logical change. Avoid combining unrelated operati
127127
**❌ Avoid mixing concerns:**
128128
```java
129129
@Change(id = "big-refactor", author = "team") // order extracted from filename
130-
public class _20250923_01_BigRefactor {
130+
public class _0001__BigRefactor {
131131
@Apply
132132
public void apply(MongoDatabase db, KafkaProducer producer) {
133133
// Adding user field
@@ -146,13 +146,13 @@ public class _20250923_01_BigRefactor {
146146
```java
147147
@TargetSystem("user-database")
148148
@Change(id = "add-user-status", author = "team") // order extracted from filename
149-
public class _20250923_01_AddUserStatus {
149+
public class _0001__AddUserStatus {
150150
// Focus: User schema change only
151151
}
152152

153153
@TargetSystem("kafka-events")
154154
@Change(id = "create-user-topic", author = "team") // order extracted from filename
155-
public class _20250923_01_CreateUserTopic {
155+
public class _0001__CreateUserTopic {
156156
// Focus: Kafka topic creation only
157157
}
158158
```
@@ -166,7 +166,7 @@ Make operations safe to re-run whenever possible.
166166
**Example: Idempotent field addition:**
167167
```java
168168
@Change(id = "add-user-preferences", author = "team") // order extracted from filename
169-
public class _20250923_01_AddUserPreferences {
169+
public class _0001__AddUserPreferences {
170170

171171
@Apply
172172
public void apply(MongoDatabase database) {
@@ -240,35 +240,33 @@ public void removeEmailIndexAndRevertSchema(MongoDatabase db) { }
240240

241241
**File names:**
242242
- Use `_ORDER_DescriptiveName` format where ORDER is extracted between first and last underscores
243-
- **Recommended format**: `YYYYMMDD_NN` where:
244-
- YYYY = year, MM = month, DD = day
245-
- NN = sequence number (01-99) for changes on the same day
243+
- **Recommended format for order**: `NNNN` with left-padding zeros (e.g., `0001`, `0002`, `0010`)
246244
- When using this naming pattern, the order in `@Change` annotation or YAML is optional
247245
- Use PascalCase for class names
248246

249247
**Good examples:**
250248
```
251-
_20250923_01_CreateUserIndexes.java
252-
_20250923_02_MigrateUserData.java
253-
_20250924_01_AddUserPreferences.java
254-
_20250925_01_OptimizeUserQueries.java
255-
_20250930_01_MigrateToNewFormat.yaml
249+
_0001__CreateUserIndexes.java
250+
_0002__MigrateUserData.java
251+
_0002__AddUserPreferences.java
252+
_0005__OptimizeUserQueries.java
253+
_0004__MigrateToNewFormat.yaml
256254
```
257255

258256
:::tip Recommendation
259-
We recommend specifying the order in the file/class name using the `YYYYMMDD_NN` format:
257+
We recommend specifying the order in the file/class name using the `NN` format:
260258

261259
**Benefits:**
262-
- **Natural chronological sorting** - Files automatically sort by date in folders
263-
- **Clear timeline visibility** - Instantly see when changes were created
264-
- **Practical daily limit** - 99 changes per day is more than sufficient
265-
- **Easy identification** - Quick visual scan shows change history
260+
- **Simple and clear** - Easy to understand and implement
261+
- **Natural sorting** - Files automatically sort numerically
262+
- **No complexity** - Just sequential numbering
263+
- **Easy identification** - Quick visual scan shows execution order
266264
- **No annotation needed** - Order is extracted from filename
267265

268266
Examples:
269-
- `_20250923_01_CreateUserTable.java` → order: "20250923_01" (no need for order in @Change)
270-
- `_20250923_02_MigrateData.yaml` → order: "20250923_02" (no need for order in YAML)
271-
- `_20250924_01_AddIndexes.java` → order: "20250924_01"
267+
- `_0001__CreateUserTable.java` → order: "0001" (no need for order in @Change)
268+
- `_0002__MigrateData.yaml` → order: "0002" (no need for order in YAML)
269+
- `_0004__AddIndexes.java` → order: "0004"
272270
:::
273271

274272

@@ -298,11 +296,11 @@ Changes should be organized chronologically by their order within stages. If you
298296

299297
```
300298
src/main/java/com/company/changes/
301-
├── _20250923_01_CreateUserCollection.java
302-
├── _20250923_02_AddUserIndexes.java
303-
├── _20250924_01_MigrateUserData.java
304-
├── _20250924_02_CreateOrdersTable.java
305-
└── _20250925_01_AddOrderStatusColumn.java
299+
├── _0001__CreateUserCollection.java
300+
├── _0002__AddUserIndexes.java
301+
├── _0003__MigrateUserData.java
302+
├── _0004__CreateOrdersTable.java
303+
└── _0005__AddOrderStatusColumn.java
306304
```
307305

308306
## Testing and validation
@@ -318,7 +316,7 @@ public void testUserMigrationChange() {
318316
MongoDatabase testDb = getTestDatabase();
319317
insertTestUsers(testDb);
320318

321-
var change = new _20250923_01_MigrateUsers();
319+
var change = new _0001__MigrateUsers();
322320

323321
// Act - Test execution
324322
change.execute(testDb);

docs/changes/domain-coupling.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ You create a Change that uses this domain class:
3838

3939
```java
4040
@Change(id = "add-premium-customers", order = "20250923_01", author = "team")
41-
public class _20250923_01_AddPremiumCustomers {
41+
public class _0001__AddPremiumCustomers {
4242

4343
@Apply
4444
public void apply(CustomerRepository repository) {
@@ -55,7 +55,7 @@ public class _20250923_01_AddPremiumCustomers {
5555
Six months later, your team decides `middleName` is unnecessary and removes it from the `Customer` class. Now:
5656

5757
- ✅ Your application works fine with the updated model
58-
- ❌ The Change `_20250923_01_AddPremiumCustomers` no longer compiles
58+
- ❌ The Change `_0001__AddPremiumCustomers` no longer compiles
5959
- ❌ You can't run Flamingock in new environments
6060
- ❌ CI/CD pipelines break
6161

@@ -69,7 +69,7 @@ Here's how the same Change looks using generic structures:
6969

7070
```java
7171
@Change(id = "add-premium-customers", order = "20250923_01", author = "team")
72-
public class _20250923_01_AddPremiumCustomers {
72+
public class _0001__AddPremiumCustomers {
7373

7474
@Apply
7575
public void apply(RestTemplate restTemplate) {

docs/changes/introduction.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Written in Java, Kotlin, or Groovy with annotations. Best for complex logic or w
3939
```java
4040
@TargetSystem("user-database")
4141
@Change(id = "add-user-status", author = "dev-team")
42-
public class _20250923_01_AddUserStatus {
42+
public class _0001__AddUserStatus {
4343

4444
@Apply
4545
public void apply(MongoDatabase database) {
@@ -58,9 +58,8 @@ public class _20250923_01_AddUserStatus {
5858
Use YAML or JSON definitions with reusable templates. Perfect for repetitive operations and standardized patterns.
5959

6060
```yaml
61-
# File: _20250923_02_add_status_column.yaml
61+
# File: _0002__AddStatusColumn.yaml
6262
id: add_status_column
63-
order: "20250923_02"
6463
author: "db-team"
6564
templateName: sql-template
6665
apply: "ALTER TABLE orders ADD COLUMN status VARCHAR(20);"

docs/changes/types-and-implementation.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ Template-based Changes use YAML or JSON files with reusable templates. Templates
2525
### Basic YAML structure
2626

2727
```yaml
28-
# File: _20250923_01_add_user_index.yaml
28+
# File: _0001__AddUserIndex.yaml
2929
id: add_user_index
30-
order: "20250923_01"
3130
author: "database-team"
3231
description: "Add index on user email field for faster lookups"
3332
targetSystem: "user-database"
@@ -57,7 +56,7 @@ Code-based Changes are written in Java, Kotlin, or Groovy with annotations. They
5756
```java
5857
@TargetSystem("user-database")
5958
@Change(id = "migrate-user-emails", author = "data-team") // order extracted from filename
60-
public class _20250923_01_MigrateUserEmails {
59+
public class _0001__MigrateUserEmails {
6160

6261
@Apply
6362
public void apply(MongoDatabase database, ClientSession session) {
@@ -93,16 +92,16 @@ public class _20250923_01_MigrateUserEmails {
9392
### Recommended project structure:
9493
```
9594
src/main/java/com/yourapp/changes/
96-
├── _20250923_01_CreateUserIndexes.java
97-
├── _20250923_02_AddUserStatus.yaml
98-
├── _20250924_01_MigrateUserData.java
99-
├── _20250924_02_SetupNotifications.yaml
100-
└── _20250925_01_OptimizeQueries.java
95+
├── _0001__CreateUserIndexes.java
96+
├── _0002__AddUserStatus.yaml
97+
├── _0003__MigrateUserData.java
98+
├── _0004__SetupNotifications.yaml
99+
└── _0003__OptimizeQueries.java
101100
```
102101

103102
### Best practices:
104103
- **Keep together**: Store both code and template files in the same directory
105-
- **Consistent naming**: Follow `_ORDER_DescriptiveName` pattern for both types (recommended: `YYYYMMDD_NN`)
104+
- **Consistent naming**: Follow `_ORDER__CHANGE_NAME` pattern for both types (recommended: `NN`)
106105
- **Order in filename**: When using the naming pattern, order in annotation/yaml is optional
107106

108107
:::info Order Field Rules

docs/flamingock-library-config/setup-and-stages.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ src/
230230
yourapp/
231231
flamingock/
232232
users/
233-
_20250923_01_CreateUsersTable.java
234-
_20250923_02_AaddIndex.yaml
233+
_0001__CreateUsersTable.java
234+
_0002__AddIndex.yaml
235235
```
236236

237237

@@ -271,22 +271,22 @@ We strongly recommend placing all your changes — code-based and template-based
271271
To ensure clarity and enforce ordering, we recommend naming changes using the following format:
272272

273273
```
274-
_20250923_01_CreateClientsTable.java
275-
_20250923_02_AaddindexToEmail.yaml
276-
_20250924_01_MigrateData.java
277-
_20250925_01_ComplexChange.yaml
274+
_0001__CreateClientsTable.java
275+
_0002__AddIndexToEmail.yaml
276+
_0003__MigrateData.java
277+
_0004__ComplexChange.yaml
278278
```
279279

280280
- `ORDER`: The execution order extracted between the first `_` and last `_`
281-
- **Recommended format**: `YYYYMMDD_NN` where YYYY=year, MM=month, DD=day, NN=sequence (01-99)
281+
- **Recommended format**: `NNNN` with left-padding zeros (e.g., `0001`, `0002`, `0010`)
282282
- `CHANGE_NAME`: Descriptive name of what the change does
283283

284284
This convention:
285285
- **Eliminates the need for order in annotations/YAML** - the order is extracted from the filename
286-
- **Natural chronological sorting** - files automatically sort by date in folders
287-
- **Clear timeline visibility** - instantly see when changes were created
286+
- **Natural sequential sorting** - files automatically sort numerically
287+
- **Clear execution order** - instantly see the sequence of changes
288288
- Works across both code-based and template-based formats
289-
- **Practical daily limit** - 99 changes per day is more than sufficient
289+
- **Sufficient capacity** - supports up to 99 changes with two-digit format
290290
- Ensures consistent naming and project hygiene
291291

292292
:::tip

0 commit comments

Comments
 (0)