Directus #Sync individual schemas and collection question

I have managed to use the cli and the directus sync.

One question is whether I could push or pull schema/collection changes independently.

I have seen the following ways from claude:

1. Schema-only (no per-collection)

docker compose exec my-directus npx directus schema-sync export-schema Pulls schema.json

(or split schema files if SCHEMA_SYNC_SPLIT=true), skips all data JSON.

2. Single-collection data pull (workaround via config)

Comment out everything in config.js except the one collection, export, then restore. E.g. for data_block_translations: # back up, edit config to only include data_block_translations, run:

docker compose exec my-directus npx directus schema-sync export --data

# --data skips the schema so you don’t churn schema.json # then restore config.js --data is important — without it, export will also rewrite your schema files.

3. Even cheaper: fetch via Directus API directly

If you just want the data for one collection and don’t care about the extension’s file format/hash mechanism, skip the extension:

curl “$DIRECTUS_URL/items/data_block_translations?limit=-1” \ -H “Authorization: Bearer $TOKEN” > data_block_translations.json

Won’t match the split-file format on disk though, so re-importing via schema-sync won’t work directly.

Could you please suggest the best solution for pulling or pushing a specific schema and collection?

2 Answers

2

Hi there :waving_hand: Welcome to the community.

Happy to help but I need a little more info to be truly helpful…

Are you referring to the built in schema endpoints inside Directus core itself?

Or are you referring to the community built extension Directus Sync?

We want to be able to use directus sync to get the schemas/collections from another server. i managed to get the data and all the jsob files but I wanted to know if I could get individual schemas/or collections this is what I shared above.

It is about the schema sync - and if there is a way we can -Ideally we should be able to promote content in collections independently. It would be nice to do same for schema, but that's Directus limitation.

It is about the schema sync - and if there is a way we can -Ideally we should be able to promote content in collections independently. It would be nice to do same for schema, but that’s Directus limitation.