python - How can I implement "archived" or "is_deleted" across all entities in my ORM? -
i've built app entities linked each other. example:
parent (id, name, age) child (id, name, age, parent_id)
i interested implement "soft delete" parent
. that, mean:
- when
parent
soft-deleted, parent no longer able viewed, updated , listed in list_views. - for existing children linked soft-deleted parent, parent_id still remain.
to put simply, trying delete parent while ensuring no child.parent_id left dangling.
i implement across entities in database.
are there existing patterns/plugins can reuse?
note: using sqlalchemy flask on python if makes difference
Comments
Post a Comment