Closed martin-braun closed 3 weeks ago
I'm assuming you are talking about changes to the schema right? Since there is some logging indicating updates/changes done to data.
@u12206050 Schema and data on schema-sync import
and just the schema on schema-sync import-schema
respectively. I started testing this only after changing the schema, so the logging of data changes went over my head. Is this logged to stdout
?
In the end parsing the stdout
works, but it's always a bit of a hack. I would kindly enjoy if there was a system in place to hash the state before and after. Even on a database level would work for me, if it's not a hog. I'm using PostgreSQL by the way.
I just re-test schema-sync import --merge
and all it prints is INFO: Importing everything from: ..../schema-sync/data
and this info also prints when I re-run the command despite there being no new data to import.
Closing this as not planned
@u12206050 I respect your decision, after all this is a very nuanced problem and Ansible is not a direct dependency of the project, although I have two questions:
Thanks.
Sure a PR is welcome.
Neither schema nor data changes should be too hard to compare and print of the diff. The main problem I see is displaying the diff in a reasonable understanding way.
@u12206050 maybe a verbose flag could help, it could print much more without disrupting the default behavior?
Yes that should be very doable. I believe in the code where we are comparing db rows to file rows would be the ideal place for this. Displaying sensible output including schema changes might still be hard though.
Describe the Improvement
I'm using Ansible for my deployment. A crucial feature of Ansible is the ability to have a
changed_when
expression for tasks, so I'm looking for a way to reliably detect if an import actually changed anything. My first guess was themv_hash
in the directus settings would change, so that I could have a shell task that executes this:A non-zero return code would indicate the next import will change my schema and data, but apparently this is not the case, the
mv_hash
doesn't match the contents of thehash.txt
after import, so I guess I was wrong on that.I also inspected the output of
npx directus schema-sync import
, but nothing indicates that changes where made, so I couldn't even parsestdout
.Could we please do something about it? I need a reliable way to see if changes where made.