- Remove old schema files when generating new schema files.
- This is to remove files of deleted collections.
- Outputs additional helpful information when error occurs.
- Link to an issue when trying to import empty files.
- Added
groupBy
parameter to collection options- (optional) array of fields to group the exported data into multiple files, eg. ['collection'] (per collection)
- This is useful when you have a large amount of data in a collection (such as
directus_permissions
) and want to split it up into multiple files.
By default will split schema file up into multiple files per collection
-
Why? This is to make it easier to manage the schema files in git, as well as to make it easier to work with the schema files in general.
-
How? The schema files will be split up into multiple files per collection. The main file will be named
schema.json
and will contain a flag stating if it is partial (split). The collection files will be named after the collection name, and will contain the schema for that collection. All collection files will be placed inschema-sync/data/schema
. -
What do I need to do?
- If you have any custom scripts that rely on the schema file, you will need to update them to work with the new structure.
- You will also need to export the schema again to get the new structure.
- Add the new schema files to git.
-
What if I don't want this? You can set
SCHEMA_SYNC_SPLIT=false
in your environment file to disable this feature.
- Update hash and timestamp after manually triggering import via cli.
- This will also force reset the lock if any errors occurred during an earlier import.
- Add
linkedFields
to fix inserting ordered items that might depend on each other.- Specifically fixes importing of flow operations, update the directus_config and add
linkedFields
.
{ directus_operations: { watch: ['operations'], excludeFields: ['user_created'], linkedFields: ['resolve', 'reject'], query: { filter: { flow: { trigger: { _neq: 'webhook' } }, }, }, }, }
- Specifically fixes importing of flow operations, update the directus_config and add
- Also fix auto IMPORT issue when mv_ts is null.
- (postgres only) Fixed import issue due to default_value containing functions for auto increment
- Fixed error thrown when installing config folder without --force
- Fixed installing of config folder
- Sorts exported object keys
- Fixes issue where the order of the exported object keys would change between exports, causing unnecessary changes in git.
- merge option fixed
- The merge option was introduced in version 1.3.0, but it was not working as intended. This has now been fixed.
- Add
import-schema
andexport-schema
commands to import/export only the schema.
- Fixed config for
directus_presets
getKey should be${o.role ?? 'all'}-${o.collection}-${o.bookmark || 'default'}
instead of${o.role ?? 'all'}-${o.collection}-${o.name || 'default'}
- Replaced cli command for install from
npx schema-sync install
tonpx directus schema-sync install
.- This way we directly create the required columns in the
directus_settings
table. - NOTE: If you have installed before, you can now remove the migration file from your migrations folder.
- This way we directly create the required columns in the
- Added config for directus_presets to sync global presets.
- Fix bug where process returns early without importing all data, when using onImport.
- Add
--merge
option to import command in order to upsert data only and not delete other data. - Add
onImport
andonExport
hooks to allow for custom logic to be run before items are imported/exported.- Can be used to encode or decode data before it is imported/exported.
- Return
null
to skip the item.
- Fixed invalid field issue due to memory leak.
- Sort automatically by sort field first with fallback to primary key.
- NOTE This update will remove duplicate rows if the same key matches multiple rows.
- This is to fix an issue where the same permission was imported multiple times.
- Change order in which deletions work.
- This fixes an issue where a collection with a relation to another collection would fail to import due to the relation being a constraint.
- Add try/catch to use best-effort when importing data.
-
Excluding alias fields by default.
-
Benefit Reduces the amount of fields you have to add to the exclude list.
-
Why? Since alias fields don't exist in the DB, they often end up being an array containing the ids of the related items. Since you should be exporting the related items anyways with the foreign key fields, this is both redundant and causes issues when importing.
-
- Fix order in which tasks are exported and imported. Specifically crucial for fields and relations.
- Fix issue for dynamic import of config on windows systems. Update logging to reflect amount of items being imported/exported.
- Switch from using path.join to path.resolve to use absolute paths as required by Windows.
- Set query limit to -1, unless manually set in config.js inside the query option.
- This fixes an issue with not all permissions being fetched.
- Add optional prefix option to differentiate between different sets of data.
- Prefix can be set on the collection configuration in config.js eg.
test
orprod
.
- Prefix can be set on the collection configuration in config.js eg.
- Fix issue with syncing across servers with different timezones.
- Add hash command, to regenerate hash for all data files.
- Add delay when reinstalling Schema Sync