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:

  1. when parent soft-deleted, parent no longer able viewed, updated , listed in list_views.
  2. 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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -