How do I reset Xray to a factory install?

Subject 

How to perform a "factory reset" on Xray

Resolution

  1. Stop Xray, Mongo, and PostgreSQL
  2. Connect to PostgreSQL and run the following:
    1. DELETE FROM blobs;
    2. DELETE FROM components;
    3. DELETE FROM file_props;
    4. DELETE FROM files;
    5. DELETE FROM generic_blobs;
    6. DELETE FROM generic_files;
    7. DELETE FROM root_files;
    8. DELETE FROM schema_migrations;
  3. Connect to Mongo and run the following:
    1. db.getCollection('user_components').drop()
    2. db.getCollection('user_packages').drop()
    3. db.getCollection('impact_paths').drop()
    4. db.getCollection('event_states').drop()
  4. Go to the RabbitMQ UI and purge all the queues
  5. Clear Artifactory:
    1. curl https://itec-artifactory.fmr.com/api/xray/clearAllIndexTasks -X DELETE -uadmin
    2. Clear all logs and files under /data/alm/jfrog/xray/data/data and /data/alm/jfrog/xray/data/logs
  6. Restart Xray