@@ -19,6 +19,49 @@ This makes the app useful for internal directories, support operations, partner
1919
2020The public API contract for this app is published as [ openapi-full.json] ( https://github.com/LibreCodeCoop/profile_fields/blob/main/openapi-full.json ) .
2121
22+ ## Data backup and import
23+
24+ Run the app commands from the Nextcloud stack root, not from the host PHP environment.
25+
26+ Export the current Profile Fields catalog and stored values:
27+
28+ ``` bash
29+ docker compose exec -u www-data -w /var/www/html nextcloud \
30+ php occ profile_fields:data:export \
31+ --output=/tmp/profile_fields-export.json
32+ ```
33+
34+ Validate an import payload without writing anything:
35+
36+ ``` bash
37+ docker compose exec -u www-data -w /var/www/html nextcloud \
38+ php occ profile_fields:data:import \
39+ --input=/tmp/profile_fields-export.json \
40+ --dry-run
41+ ```
42+
43+ Apply the non-destructive ` upsert ` import:
44+
45+ ``` bash
46+ docker compose exec -u www-data -w /var/www/html nextcloud \
47+ php occ profile_fields:data:import \
48+ --input=/tmp/profile_fields-export.json
49+ ```
50+
51+ Notes:
52+
53+ - The import contract is versioned with ` schema_version ` and reconciles definitions by ` field_key ` and values by ` field_key + user_uid ` .
54+ - The first delivery is non-destructive: missing items in the payload do not delete existing definitions or values.
55+ - Validation is all-or-nothing. If the payload contains an incompatible definition or a missing destination user, no database write is performed.
56+ - For a restore in the same environment, clear app data explicitly before reimporting:
57+
58+ ``` bash
59+ docker compose exec -u www-data -w /var/www/html nextcloud \
60+ php occ profile_fields:data:clear \
61+ --definitions \
62+ --force
63+ ```
64+
2265## Screenshots
2366
2467![ Admin catalog] ( img/screenshots/admin-catalog.png )
0 commit comments