Skip to content

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

Closed
@dgarros

Description

@dgarros

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions