Skip to content

Commit 1dfee2a

Browse files
committed
docs: order
1 parent 5956cca commit 1dfee2a

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

docs/changes/anatomy-and-structure.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ The `order` determines when the Change executes relative to others.
4545
- In the annotation (@Change) or YAML structure
4646
- Both are optional, but **at least one is required**
4747
- If order is specified in **both** locations, they **must be identical**
48-
- For file/class names:
49-
- Must start with underscore `_`
50-
- Order is extracted between the first `_` and the last `_`
51-
- Recommended format: `YYYYMMDD_NN` (e.g., `_20250923_01_CreateUserTable.java`)
52-
- Order extracted: everything between first and last underscore (e.g., `20250923_01`)
48+
- **For file/class names - Order Extraction Rule**:
49+
- **Must start with underscore `_`** (first character)
50+
- **Order is everything between the first `_` and the last `_`**
51+
- **Examples of order extraction**:
52+
- `_20250923_01_CreateUserTable.java` → order: `20250923_01`
53+
- `_001_SimpleChange.java` → order: `001`
54+
- `_2024_12_25_HolidayUpdate.yaml` → order: `2024_12_25`
55+
- `_V1_0_1_DatabaseUpgrade.java` → order: `V1_0_1`
56+
- **Recommended format**: `YYYYMMDD_NN` (year-month-day-sequence)
5357
- Orders are evaluated in alphanumeric order
5458
:::
5559

@@ -225,11 +229,28 @@ _20250924_01_AddUserStatusColumn.yaml
225229
_20250925_01_OptimizeQueries.java
226230
```
227231

232+
### How Flamingock Extracts Order from Filenames
233+
234+
Flamingock uses a simple rule to extract the order value from your filename:
235+
236+
1. **Filename must start with underscore `_`**
237+
2. **Everything between the first `_` and the last `_` becomes the order**
238+
3. **Everything after the last `_` is treated as the descriptive name**
239+
240+
**Step-by-step examples:**
241+
242+
| Filename | First `_` | Last `_` | Extracted Order | Descriptive Name |
243+
|----------|-----------|----------|----------------|------------------|
244+
| `_20250923_01_CreateUsers.java` | position 0 | position 11 | `20250923_01` | `CreateUsers.java` |
245+
| `_001_SimpleChange.yaml` | position 0 | position 4 | `001` | `SimpleChange.yaml` |
246+
| `_V1_0_1_DatabaseUpgrade.java` | position 0 | position 7 | `V1_0_1` | `DatabaseUpgrade.java` |
247+
228248
**Rules:**
229249
- Start with underscore and order (recommended: YYYYMMDD_NN format)
230250
- Use PascalCase for descriptive names
231-
- Match the `order` property in the annotation if provided
251+
- If order is also specified in annotation/YAML, both values **must be identical**
232252
- Applies to both code (.java/.kt/.groovy) and template (.yaml/.json) files
253+
- Orders are compared alphanumerically for execution sequence
233254

234255
## Complete example
235256

0 commit comments

Comments
 (0)