You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/DATA_STRUCTURE_VERSION.md
+63Lines changed: 63 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,67 @@ This data structure version management system automatically handles application
16
16
4.**Data Backup**: Provides data backup functionality to ensure safe migration
17
17
5.**Extensibility**: Easy to add new version migration logic
18
18
19
+
## Quick Start
20
+
21
+
The system is automatically integrated into the application — no additional configuration is required. Data migration checks and execution happen automatically on each app startup.
22
+
23
+
### When to upgrade the version?
24
+
25
+
Upgrade the data structure version whenever you need to:
26
+
27
+
1. ✅ Add new configuration fields
28
+
2. ✅ Modify existing field data types (e.g., `String` → `Long`)
29
+
3. ✅ Remove unused fields
30
+
4. ✅ Reorganize data into different storage locations
31
+
5. ✅ Modify data formats or structures
32
+
33
+
### Add a new version in 3 steps
34
+
35
+
```kotlin
36
+
// Step 1 — bump the version in DataMigrationManager.kt
37
+
constvalCURRENT_DATA_VERSION=2// Change from 1 to 2
38
+
39
+
// Step 2 — add a migration case in performMigration()
> ⚠️ Increment the version by 1 for every data-structure change, make migration logic handle **all** older versions, test thoroughly, and document each change.
77
+
>
78
+
> The sections below cover the same workflow in detail, plus the API reference, version history, fuller scenarios, and troubleshooting.
79
+
19
80
## Usage
20
81
21
82
### Initialization
@@ -179,6 +240,8 @@ Reset data structure version. **Warning**: Use with caution, may cause data inco
179
240
180
241
## Example Scenarios
181
242
243
+
For runnable, practical examples, also see `MigrationExamples.kt` alongside `DataMigrationManager.kt`.
244
+
182
245
### Scenario 1: Adding New Feature Requiring New Field
0 commit comments