User Tools

Site Tools


delete_data_in_the_database_directly_via_ssh

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
delete_data_in_the_database_directly_via_ssh [2018/05/07 21:57] – [Delete all endusers] lucydelete_data_in_the_database_directly_via_ssh [2021/05/19 08:10] (current) – [Delete all templates files] lucy
Line 1: Line 1:
-===== Delete all "deleted campaigns" from database ===== 
-sudo -u postgres psql phishing 
-delete from exports where campaign_id in (select id from campaigns where is_deleted=true); 
-delete from campaigns where is_deleted=true; 
- 
- 
 ===== Delete all scenario templates ===== ===== Delete all scenario templates =====
-sudo -u postgres psql phishing -c "DELETE FROM scenario_templates WHERE NOT is_deleted"+sudo -u postgres psql phishing -c 'DELETE FROM scenario_templates'
  
 ===== Delete all Awareness template ===== ===== Delete all Awareness template =====
-sudo -u postgres psql phishing -c "DELETE FROM awareness_templates WHERE NOT is_deleted"+sudo -u postgres psql phishing -c 'DELETE FROM awareness_templates
 + 
 +===== Delete all templates files =====
  
-===== Delete all file templates ===== 
 sudo rm -rf /opt/phishing/files/scenario-templates/* sudo rm -rf /opt/phishing/files/scenario-templates/*
 +
 sudo rm -rf /opt/phishing/files/awareness-templates/* sudo rm -rf /opt/phishing/files/awareness-templates/*
  
 ===== Delete all endusers ===== ===== Delete all endusers =====
-sudo -u postgres psql phishing +sudo -u postgres psql phishing -c 'DELETE FROM users WHERE role_id=5'
-UPDATE users SET is_deleted=true WHERE NOT is_deleted AND role_id=5+
-\q+
  
  
 ===== Delete all LUCY users (not admin) ===== ===== Delete all LUCY users (not admin) =====
-sudo -u postgres psql phishing -c "UPDATE users SET is_deleted=TRUE where role_id=3"+sudo -u postgres psql phishing -c 'DELETE FROM users WHERE role_id=3'
  
  
delete_data_in_the_database_directly_via_ssh.1525723050.txt.gz · Last modified: 2019/07/25 12:50 (external edit)