--
-- drop SQL for survey package
--
-- by nstrug@arsdigita.com on 29th September 2000
--
-- $Id: survey-drop.sql,v 1.2 2004/02/07 11:25:51 maltes Exp $

\i survey-package-drop.sql
\i survey-notifications-drop.sql

drop view survey_ques_responses_latest;
drop view survey_responses_latest;
drop table survey_question_responses;
drop table survey_responses;
drop table survey_conditions;
drop table survey_question_choices;
drop sequence survey_choice_id_sequence;
drop table survey_questions;
drop table survey_predef_question_choices;
drop table survey_predefined_questions;
drop table survey_block_questions;
drop table survey_block_sections;
drop sequence survey_block_section_id_seq;
drop sequence survey_block_choice_id_seq;
drop table survey_branches;
drop sequence survey_branch_id_sequence;
drop table survey_conditions;
drop sequence survey_condition_id_sequence;
drop table survey_sections;
drop table surveys;

drop table survey_templates;


-- nuke all created objects
-- need to do this before nuking the types
delete from acs_objects where object_type = 'survey_response';
delete from acs_objects where object_type = 'survey_question';
delete from acs_objects where object_type = 'survey_section';
delete from acs_objects where object_type = 'survey';

  select acs_object_type__drop_type ('survey_response','f');
  select acs_object_type__drop_type ('survey_question','f');
  select acs_object_type__drop_type ('survey_predefined_question','f');
  select acs_object_type__drop_type ('survey_section','f');
  select acs_object_type__drop_type ('survey','f');

--   select acs_privilege__remove_child ('admin','survey_admin_survey');
--   select acs_privilege__remove_child ('write','survey_take_survey');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_delete_question');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_modify_question');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_create_question');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_delete_section');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_modify_section');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_create_section');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_delete_survey');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_modify_survey');
--   select acs_privilege__remove_child ('survey_admin_survey','survey_create_survey');
  
--   select acs_privilege__drop_privilege('survey_admin_survey'); 
--   select acs_privilege__drop_privilege('survey_take_survey'); 
--   select acs_privilege__drop_privilege('survey_delete_question'); 
--   select acs_privilege__drop_privilege('survey_modify_question'); 
--   select acs_privilege__drop_privilege('survey_create_question');
--   select acs_privilege__drop_privilege('survey_delete_section'); 
--   select acs_privilege__drop_privilege('survey_modify_section'); 
--   select acs_privilege__drop_privilege('survey_create_section');  
--   select acs_privilege__drop_privilege('survey_delete_survey'); 
--   select acs_privilege__drop_privilege('survey_modify_survey'); 
--   select acs_privilege__drop_privilege('survey_create_survey'); 



