| 39 | -- czyszczenie usuniętych wpisów |
| 40 | DELETE from fk_elements WHERE doc_id IN (SELECT doc_id FROM documents where adduid IN (SELECT usr_id FROM users where is_del is true)); |
| 41 | |
| 42 | delete from documents where adduid IN (SELECT usr_id FROM users where is_del is true); |
| 43 | |
| 44 | delete from rcp_cards WHERE emp_id IN(SELECT usr_id FROM users where is_del is true); |
| 45 | |
| 46 | delete from readed_comments where usr_id IN (SELECT usr_id FROM users where is_del is true); |
| 47 | |
| 48 | delete from contacts_caretakers where usr_id IN (SELECT usr_id FROM users where is_del is true); |
| 49 | |
| 50 | delete from vindication.vind_proc where vindyc IN (SELECT usr_id FROM users where is_del is true); |
| 51 | |
| 52 | DELETE from fk_elements WHERE adduid IN (SELECT usr_id FROM users where is_del is true); |
| 53 | |
| 54 | delete from users where is_del is true; |
| 55 | |
| 56 | delete from rcp_cards WHERE prc_id IN(select prc_id from processes where is_del is true); |
| 57 | |
| 58 | delete from fk_elements WHERE prc_id IN(select prc_id from processes where is_del is true); |
| 59 | |
| 60 | delete from process_participants WHERE prc_id IN(select prc_id from processes where is_del is true); |
| 61 | |
| 62 | delete from processes where is_del is true; |
| 63 | |
| 64 | delete FROM organization_units WHERE is_del IS TRUE; |
| 65 | |
| 66 | delete from fk_elements WHERE doc_id IN(SELECT doc_id FROM documents where is_del is true); |
| 67 | |
| 68 | delete from documents where is_del is true; |
| 69 | |
| 70 | |