Closed Natetronn closed 5 months ago
AH I see where the misunderstanding comes it. So when you edit a json file directly, you will need to recalculate the hash by running the npx directus schema-sync hash
command. This will update the hash.txt file so the plugin knows a change has actually occurred.
NOTE: This will only import the new data on the next server start up.
I assume the solution I mentioned worked. Let me know then we can reopen the issue
Describe the Bug
Honestly, I'm not sure if it's a bug or if it's something on my end, but automatic import doesn't work, even with SCHEMA_SYNC set to BOTH.
Note: I tried both
SCHEMA_SYNC: "BOTH"
andSCHEMA_SYNC: BOTH
too. This after destroying the instance and starting it fresh to make sure the change was indeed set.Manual importing using the cli does work, however. Auto export also works; when creating or updating items in the same collection, I see the changes locally in the json files.
I'm using SQLite to test with. This is my docker-compose.yml and Dockerfile for testing purposes. I'm on Linux. I opened up all file/folder permissions wide, since it was for testing:
docker-compose.yml
Dockerfile
To Reproduce
After installing directus-schema-sync, per the docs, including making the tables etc, making sure SCHEMA_SYNC is set to BOTH and making sure permissions and everything else is in working order, create a collection with at least one input field and create an item or two. Make sure this collection is in the config.js file and ready to go per the example and comments in that file.
Then try running an export automatically by creating new items. You should see the collection's json file was exported with the items in the collection, along with the other files for directus system tables and a schema file too. Now, edit the collection's json file by adding a new item to the object, with a new id and some new data in the field/s, and then save the file. You'd expect to see the changes made in the Studio App at this point, since it should be automated and see the new item listed with the others, but that's not the case.
Note: after that we tried restarting the docker container to see if helped, but it didn't seem to. We also tried a empty cache and hard reload in the browser as well.
You can see that importing via the cli does in fact work by running the
npx directus schema-sync import
and this does import the changes, so importing can work at least. It's only the auto importing that isn't working, at least in our case.Version
1.6.1
Installed Extension Via
Docker file