@@ -3,19 +3,19 @@ title: Anatomy & Structure
33sidebar_position : 2
44---
55
6- # ChangeUnit Anatomy & Structure
6+ # Change Anatomy & Structure
77
8- Every ChangeUnit follows a consistent structure with required properties, optional configurations, and specific annotations. Understanding this anatomy is essential for creating reliable changes.
8+ Every Change follows a consistent structure with required properties, optional configurations, and specific annotations. Understanding this anatomy is essential for creating reliable changes.
99
1010## Required properties
1111
12- Every ChangeUnit must define these three properties:
12+ Every Change must define these three properties:
1313
1414### ` id ` - Unique identifier
15- The ` id ` must be unique across all ChangeUnits in your application.
15+ The ` id ` must be unique across all Changes in your application.
1616
1717``` java
18- @ChangeUnit (id = " add-user-status" , order = " 0001" , author = " dev-team" )
18+ @Change (id = " add-user-status" , order = " 0001" , author = " dev-team" )
1919```
2020
2121** Rules:**
@@ -24,12 +24,12 @@ The `id` must be unique across all ChangeUnits in your application.
2424- Cannot be modified once deployed
2525
2626### ` order ` - Execution sequence
27- The ` order ` determines when the ChangeUnit executes relative to others.
27+ The ` order ` determines when the Change executes relative to others.
2828
2929``` java
30- @ChangeUnit (id = " create-indexes" , order = " 0001" , author = " dev-team" )
31- @ChangeUnit (id = " migrate-data" , order = " 0002" , author = " dev-team" )
32- @ChangeUnit (id = " cleanup-temp-data" , order = " 0003" , author = " dev-team" )
30+ @Change (id = " create-indexes" , order = " 0001" , author = " dev-team" )
31+ @Change (id = " migrate-data" , order = " 0002" , author = " dev-team" )
32+ @Change (id = " cleanup-temp-data" , order = " 0003" , author = " dev-team" )
3333```
3434
3535** Requirements:**
@@ -42,8 +42,8 @@ The `order` determines when the ChangeUnit executes relative to others.
4242Identifies who is responsible for this change.
4343
4444``` java
45- @ChangeUnit (id = " update-schema" , order = " 0001" , author = " database-team" )
46- @ChangeUnit (
id = " migrate-users" ,
order = " 0002" ,
author = " [email protected] " )
45+ @Change (id = " update-schema" , order = " 0001" , author = " database-team" )
46+ @Change (
id = " migrate-users" ,
order = " 0002" ,
author = " [email protected] " )
4747```
4848
4949** Best practices:**
@@ -57,9 +57,9 @@ Identifies who is responsible for this change.
5757Briefly describes what the change does, especially useful for complex operations.
5858
5959``` java
60- @ChangeUnit (
61- id = " optimize-user-queries" ,
62- order = " 0001" ,
60+ @Change (
61+ id = " optimize-user-queries" ,
62+ order = " 0001" ,
6363 author = " performance-team" ,
6464 description = " Add composite index on user table to improve search performance"
6565)
@@ -69,9 +69,9 @@ Briefly describes what the change does, especially useful for complex operations
6969Controls whether the change runs within a transaction (default: ` true ` ).
7070
7171``` java
72- @ChangeUnit (
73- id = " create-large-index" ,
74- order = " 0001" ,
72+ @Change (
73+ id = " create-large-index" ,
74+ order = " 0001" ,
7575 author = " db-team" ,
7676 transactional = false // DDL operations may require this
7777)
@@ -90,14 +90,14 @@ Controls how Flamingock handles execution failures (default: `MANUAL_INTERVENTIO
9090
9191``` java
9292// Default behavior (manual intervention)
93- @ChangeUnit (id = " critical-change" , order = " 0001" , author = " team" )
93+ @Change (id = " critical-change" , order = " 0001" , author = " team" )
9494public class CriticalChange {
9595 // Execution stops on failure, requires manual resolution
9696}
9797
9898// Automatic retry
9999@Recovery (strategy = RecoveryStrategy . ALWAYS_RETRY )
100- @ChangeUnit (id = " idempotent-change" , order = " 0002" , author = " team" )
100+ @Change (id = " idempotent-change" , order = " 0002" , author = " team" )
101101public class IdempotentChange {
102102 // Automatically retries on failure until successful
103103}
@@ -112,24 +112,24 @@ For detailed information on recovery strategies, see [Safety and Recovery](../sa
112112## Required annotations
113113
114114### ` @TargetSystem ` - System specification
115- Declares which target system this ChangeUnit affects.
115+ Declares which target system this Change affects.
116116
117117``` java
118118@TargetSystem (" user-database" )
119- @ChangeUnit (id = " add-user-fields" , order = " 0001" , author = " api-team" )
119+ @Change (id = " add-user-fields" , order = " 0001" , author = " api-team" )
120120public class _0001_AddUserFields {
121121 // Implementation
122122}
123123```
124124
125125
126- ### ` @ChangeUnit ` - Class marker
127- Marks the class as a ChangeUnit and contains all metadata.
126+ ### ` @Change ` - Class marker
127+ Marks the class as a Change and contains all metadata.
128128
129129``` java
130- @ChangeUnit (
130+ @Change (
131131 id = " migrate-user-data" ,
132- order = " 0001" ,
132+ order = " 0001" ,
133133 author = " migration-team" ,
134134 description = " Migrate legacy user format to new schema" ,
135135 transactional = true
@@ -138,12 +138,12 @@ Marks the class as a ChangeUnit and contains all metadata.
138138
139139## Required methods
140140
141- ### ` @Execution ` - Change logic
141+ ### ` @Apply ` - Change logic
142142Contains the actual change implementation.
143143
144144``` java
145- @Execution
146- public void execute (MongoDatabase database, ClientSession session) {
145+ @Apply
146+ public void apply (MongoDatabase database, ClientSession session) {
147147 // Your change logic here
148148 database. getCollection(" users" )
149149 .insertOne(session, new Document (" status" , " active" ));
@@ -156,11 +156,11 @@ public void execute(MongoDatabase database, ClientSession session) {
156156- Parameters are dependency-injected by Flamingock
157157- Should contain idempotent operations when possible
158158
159- ### ` @RollbackExecution ` - Undo logic
159+ ### ` @Rollback ` - Undo logic
160160Provides logic to reverse the change, essential for safety and CLI undo operations.
161161
162162``` java
163- @RollbackExecution
163+ @Rollback
164164public void rollback(MongoDatabase database, ClientSession session) {
165165 // Undo the change
166166 database. getCollection(" users" )
@@ -176,18 +176,18 @@ public void rollback(MongoDatabase database, ClientSession session) {
176176
177177## Method parameters and dependency injection
178178
179- ChangeUnits receive dependencies through method parameters, automatically injected by Flamingock from the target system's context, global context, or underlying framework context.
179+ Changes receive dependencies through method parameters, automatically injected by Flamingock from the target system's context, global context, or underlying framework context.
180180
181181``` java
182182// MongoDB target system
183- @Execution
184- public void execute (MongoDatabase database, ClientSession session) {
183+ @Apply
184+ public void apply (MongoDatabase database, ClientSession session) {
185185 // database and session injected from target system or global context
186186}
187187
188- // SQL target system
189- @Execution
190- public void execute (DataSource dataSource) {
188+ // SQL target system
189+ @Apply
190+ public void apply (DataSource dataSource) {
191191 // dataSource and connection injected from target system or global context
192192}
193193```
@@ -196,7 +196,7 @@ For more details on how dependency resolution works, see [Context and dependenci
196196
197197## File naming conventions
198198
199- All ChangeUnit files must follow the ` _XXXX_DescriptiveName ` pattern:
199+ All Change files must follow the ` _XXXX_DescriptiveName ` pattern:
200200
201201```
202202_0001_CreateUserIndexes.java
@@ -213,21 +213,21 @@ _0100_OptimizeQueries.java
213213
214214## Complete example
215215
216- Here's a complete ChangeUnit showing all elements:
216+ Here's a complete Change showing all elements:
217217
218218``` java
219219@TargetSystem (" user-database" )
220- @ChangeUnit (
221- id = " add-user-preferences" ,
222- order = " 0001" ,
220+ @Change (
221+ id = " add-user-preferences" ,
222+ order = " 0001" ,
223223 author = " user-experience-team" ,
224224 description = " Add preferences object to user documents with default values" ,
225225 transactional = true
226226)
227227public class _0001_AddUserPreferences {
228228
229- @Execution
230- public void execute (MongoDatabase database , ClientSession session ) {
229+ @Apply
230+ public void apply (MongoDatabase database , ClientSession session ) {
231231 // Add preferences field with default values
232232 Document defaultPreferences = new Document ()
233233 .append(" notifications" , true )
@@ -242,7 +242,7 @@ public class _0001_AddUserPreferences {
242242 );
243243 }
244244
245- @RollbackExecution
245+ @Rollback
246246 public void rollback (MongoDatabase database , ClientSession session ) {
247247 // Remove the preferences field
248248 database. getCollection(" users" )
@@ -257,6 +257,6 @@ public class _0001_AddUserPreferences {
257257
258258## Next steps
259259
260- - ** [ ChangeUnit types & Implementation] ( ./types-and-implementation ) ** - Deep dive into code-based vs template-based approaches
261- - ** [ ChangeUnit best Practices] ( ./best-practices ) ** - Learn proven patterns for reliable ChangeUnits
260+ - ** [ Change types & Implementation] ( ./types-and-implementation ) ** - Deep dive into code-based vs template-based approaches
261+ - ** [ Change best Practices] ( ./best-practices ) ** - Learn proven patterns for reliable Changes
262262- ** [ Target Systems] ( ../target-systems/introduction ) ** - Configure where your changes will be applied
0 commit comments