3
3
The ` directus-sync ` command-line interface (CLI) provides a set of tools for managing and synchronizing the schema and
4
4
collections within Directus across different environments.
5
5
6
+ By leveraging Directus's REST API, it aligns closely with the native actions performed within the application, ensuring
7
+ a high fidelity of operation.
8
+
9
+ Updates are granular, focusing on differential data changes rather than blunt table
10
+ overwrites, which means only the necessary changes are applied, preserving the integrity and history of your data.
11
+
12
+ Moreover, ` directus-sync ` organizes backups into multiple files, significantly improving readability and making it
13
+ easier to track and review changes. This thoughtful separation facilitates a smoother version control process, allowing
14
+ for targeted updates and clearer oversight of your Directus configurations.
15
+
6
16
# Usage
7
17
8
18
The CLI is available using the ` npx ` command.
@@ -13,36 +23,6 @@ npx directus-sync <command> [options]
13
23
14
24
Here's how to use each command in the CLI:
15
25
16
- ## Global Options
17
-
18
- These options can be used with any command to configure the operation of ` directus-sync ` :
19
-
20
- - ` -d, --debug `
21
- Display additional logging information. Useful for debugging or verifying what ` directus-sync ` is doing under the
22
- hood.
23
-
24
- - ` -u, --directus-url <directusUrl> `
25
- Specify the Directus instance URL. Alternatively, set the ` DIRECTUS_URL ` environment variable.
26
-
27
- - ` -t, --directus-token <directusToken> `
28
- Provide the Directus access token. Alternatively, set the ` DIRECTUS_TOKEN ` environment variable.
29
-
30
- - ` --no-split `
31
- Indicates whether the schema snapshot should be split into multiple files. By default, snapshots are split.
32
-
33
- - ` --dump-path <dumpPath> `
34
- Set the base path for the dump. This must be an absolute path. The default
35
- is ` "./directus-config" ` .
36
-
37
- - ` --collections-path <collectionPath> `
38
- Specify the path for the collections dump, relative to the dump path. The default is ` "collections" ` .
39
-
40
- - ` --snapshot-path <snapshotPath> `
41
- Specify the path for the schema snapshot dump, relative to the dump path. The default is ` "snapshot" ` .
42
-
43
- - ` -h, --help `
44
- Display help information for the ` directus-sync ` commands.
45
-
46
26
## Commands
47
27
48
28
### Pull
@@ -81,6 +61,39 @@ npx directus-sync untrack --collection <collection> --id <id>
81
61
Removes tracking from an element within Directus. You must specify the collection and the ID of the element you wish to
82
62
stop tracking.
83
63
64
+ ## Global Options
65
+
66
+ These options can be used with any command to configure the operation of ` directus-sync ` :
67
+
68
+ - ` -d, --debug `
69
+ Display additional logging information. Useful for debugging or verifying what ` directus-sync ` is doing under the
70
+ hood.
71
+
72
+ - ` -u, --directus-url <directusUrl> `
73
+ Specify the Directus instance URL. Alternatively, set the ` DIRECTUS_URL ` environment variable.
74
+
75
+ - ` -t, --directus-token <directusToken> `
76
+ Provide the Directus access token. Alternatively, set the ` DIRECTUS_TOKEN ` environment variable.
77
+
78
+ - ` --no-split `
79
+ Indicates whether the schema snapshot should be split into multiple files. By default, snapshots are split.
80
+
81
+ - ` --dump-path <dumpPath> `
82
+ Set the base path for the dump. This must be an absolute path. The default
83
+ is ` "./directus-config" ` .
84
+
85
+ - ` --collections-path <collectionPath> `
86
+ Specify the path for the collections dump, relative to the dump path. The default is ` "collections" ` .
87
+
88
+ - ` --snapshot-path <snapshotPath> `
89
+ Specify the path for the schema snapshot dump, relative to the dump path. The default is ` "snapshot" ` .
90
+
91
+ - ` -f, --force `
92
+ Force the diff of schema, even if the Directus version is different. The default is ` false ` .
93
+
94
+ - ` -h, --help `
95
+ Display help information for the ` directus-sync ` commands.
96
+
84
97
### Tracked Elements
85
98
86
99
` directus-sync ` tracks the following Directus collections:
0 commit comments