Skip to content

Add model flags to control which crud method should be executed on sync #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dgarros opened this issue Dec 16, 2021 · 0 comments · Fixed by #87
Closed

Add model flags to control which crud method should be executed on sync #85

dgarros opened this issue Dec 16, 2021 · 0 comments · Fixed by #87

Comments

@dgarros
Copy link
Contributor

dgarros commented Dec 16, 2021

Environment

  • DiffSync version: 1.3.0

Proposed Functionality

It would be very useful to have a few more Model flags to control which CRUD methods (create/update/delete) would be called during a sync()

I would like to propose

  • CRUD_NO_UPDATE: Do not call update() on the DiffSyncModel during sync(), the model and the changes will still be visible in the diff.
  • CRUD_NO_DELETE: Do not call delete() on the DiffSyncModel during sync(), the model and the changes will still be visible in the diff.
  • CRUD_NO_UPDATE_DELETE = CRUD_NO_UPDATE | CRUD_NO_DELETE

I wish we could support CRUD_NO_CREATE but I don't think this is possible right now because we can't pass context to this method since the model doesn't exist yet.

Use Case

The main use case for me would be to protect some object to be READ_ONLY but still show up in the diff while other objects of the same type would remain READ_WRITE.
As an example
When using the network-importer, once we have done the initial import of the SOT and the data has been cleaned up, it would be useful to protect some objects from being updated/deleted in the SOT but it's still interesting to have these objects show up in the diff.
Today for this use case we are using the flag IGNORE but the object is completely ignored and doesn't show up in the diff at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant