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
We are using force since we do want to replace the `schema-sync` folder already added as a volumn
70
+
We are using force since we do want to replace the `schema-sync` folder already added as a volume
71
71
72
72
---
73
73
74
74
## 1 via NPM (Assuming you are running Directus via NPM)
75
75
76
76
1. `npm install directus-extension-schema-sync`
77
77
2. Then run `directus schema-sync install` to install the extension's columns in the database and add the config folder
78
-
4. Edit the `config.js` in the schema directory and add your collections you want to sync
79
-
5. Finally run `directus schema-sync export` to export the schema and data from the Directus API
78
+
3. Edit the `config.js` in the schema directory and add your collections you want to sync
79
+
4. Finally run `directus schema-sync export` to export the schema and data from the Directus API
80
80
81
81
## 2 Configuration
82
82
83
-
View and edit the schema-sync/*_config.js_ file to include the collections you want to sync.
83
+
View and edit the schema-sync/*_config.js_ file to include the collections you want to sync.
84
84
85
85
To automatically import and export the schema and data, set the `SCHEMA_SYNC` environment variable to `IMPORT`, `EXPORT` or `BOTH`.
86
86
In production it is advised to set `SCHEMA_SYNC` to `IMPORT` and in local development to `BOTH`.
87
87
88
+
Note: This extension will not work if there is no row in the `directus_settings` database table. To avoid this happening, make sure `PROJECT_NAME` configuration variable is set when Directus is first time installed into the database. Alternatively, if Directus is already installed, just manually create a row in `directus_settings`, if one is not already there, with whatever project name you want and keep everything else to defaults.
89
+
88
90
### Tips
89
91
90
92
**Order matters** when importing and exporting. For example if you have a collection (A) with a relation to another collection (B), then ensure in the config that collection (B) comes first. This is so when we import, we first import B, then A. Deletions happen afterward in the reverse order.
0 commit comments