Changes between Initial Version and Version 1 of BluePrintDeletionCascades


Ignore:
Timestamp:
05/16/12 12:30:39 (13 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BluePrintDeletionCascades

    v1 v1  
     1= !BluePrint: Deletion Cascades =
     2[[TOC]]
     3
     4== Introduction ==
     5
     6Deleting a record in Sahana Eden may require to update (or even delete) other records in other tables as well, in order to ensure the referential integrity of the database.
     7
     8Currently, this is controlled by the ondelete-setting of foreign key constraints:
     9
     10  ||'''ondelete'''||'''Behavior'''||
     11  ||RESTRICT||prevents the deletion of the referenced record as long as there is still at least one reference||
     12  ||CASCADE||deletes the referencing record as well||
     13  ||SET DEFAULT||changes the foreign key in the referencing record to its default value||
     14  ||SET NULL||changes the foreign key in the referencing record to NULL||
     15
     16Additionally, it is possible to define a custom ondelete-cascade for a table.
     17
     18== Description ==
     19
     20The proposed change will allow a controlled override of the RESTRICT setting in 3 stages:
     21
     22  - conditional restrict-override: automatically override a RESTRICT under certain conditions and perform predefined cascading methods
     23  - user confirmed restrict-override: requests user confirmation to override a RESTRICT (and perform pre-defined cascading methods)
     24  - user-defined conditional cascades: requests cascading methods from the user to override a RESTRICT
     25
     26== Requirements ==
     27
     28The implementation of this BluePrint requires:
     29
     30  - an "undelete" REST method to undelete records (and their original refences)
     31  - a framework to reconstruct for deleted records (both, for undelete and represent)
     32  - a conditional two-phase "delete" REST method which can present forms to the user
     33  - a cascading method "SKIP" which "soft-deletes" (archives) the referenced record but retains the reference
     34  - a user confirmation dialog when auto-deleting linktable-linked components
     35
     36== Use-Cases ==
     37
     38  - ''tbw''
     39
     40== Design ==
     41
     42=== Conditional RESTRICT Override ===
     43
     44This should implement a hook which can be called whenever resource.delete() finds a RESTRICT, and which returns an alternative action which can then be used to run through the normal cascade (where it turns RESTRICT again, the cascade would stop).
     45
     46=== User-confirmed RESTRICT Override ===
     47
     48This should implement a user dialog:
     49
     50  - GET delete would return a list of records which have a RESTRICT for the current record
     51  - each item in the list explains the cascade action
     52  - the user can confirm the whole cascade or abort the attempt
     53
     54=== User-defined Action upon RESTRICT Override ===
     55
     56  - GET delete would return a list of records which have a RESTRICT for the current record
     57  - each item in the list has a selector of possible cascade actions
     58  - the user can alter the cascade actions, confirm the whole cascade or abort the attempt
     59
     60== Implementation ==
     61
     62  - not started yet
     63
     64== References ==
     65
     66----
     67BluePrints