TRUNCATE `accounts`;
TRUNCATE `accountsaccount_cstm`;
TRUNCATE `accounts_audit`;
TRUNCATE `accounts_bugs`;
TRUNCATE `accounts_cases`;
TRUNCATE `accounts_contacts`;
TRUNCATE `accounts_opportunities`;
TRUNCATE `acl_session`;
TRUNCATE `bankactions_history`;
TRUNCATE `bankexport_salesnos`;
TRUNCATE `bankinfo_history`;
TRUNCATE `bank_account`;
TRUNCATE `batch_items`;
TRUNCATE `batch_manager`;
TRUNCATE `bugs`;
TRUNCATE `bugs_audit`;
TRUNCATE `calls`;
TRUNCATE `calls_contacts`;
TRUNCATE `calls_users`;
TRUNCATE `campaigns`;
TRUNCATE `campaigns_audit`;
TRUNCATE `campaign_log`;
TRUNCATE `cases`;
TRUNCATE `cases_audit`;
TRUNCATE `cases_bugs`;
TRUNCATE `category_tree`;
TRUNCATE `combiniactions_history`;
TRUNCATE `combini_history`;
TRUNCATE `config_export_fields`;
TRUNCATE `contacts_audit`;
TRUNCATE `contacts_bugs`;
TRUNCATE `contacts_cases`;
TRUNCATE `contacts_sms_memo`;
TRUNCATE `contacts_users`;
TRUNCATE `course_categories_contacts`;
TRUNCATE `course_category`;
TRUNCATE `currencies`;
TRUNCATE `dashboards`;
TRUNCATE `documents`;
TRUNCATE `document_revisions`;
TRUNCATE `emailman`;
TRUNCATE `emailman_sent`;
TRUNCATE `emails`;
TRUNCATE `emailsemail_cstm`;
TRUNCATE `emails_cases`;
TRUNCATE `emails_contacts`;
TRUNCATE `emails_opportunities`;
TRUNCATE `emails_users`;
TRUNCATE `email_marketing`;
TRUNCATE `email_marketing_prospect_lists`;
TRUNCATE `email_templates`;
TRUNCATE `event_contacts`;
TRUNCATE `event_resource`;
TRUNCATE `exam`;
TRUNCATE `exam_grades`;
TRUNCATE `exam_student`;
TRUNCATE `exam_subject`;
TRUNCATE `feeds`;
TRUNCATE `files`;
TRUNCATE `forums`;
TRUNCATE `forumtopics`;
TRUNCATE `gakkomaster`;
TRUNCATE `gakko_contacts`;
TRUNCATE `homework`;
TRUNCATE `iframes`;
TRUNCATE `import_maps`;
TRUNCATE `inbound_email_autoreply`;
TRUNCATE `keiriposactions_history`;
TRUNCATE `keiripos_history`;
TRUNCATE `leads`;
TRUNCATE `leads_audit`;
TRUNCATE `leads_cstm`;
TRUNCATE `meetings`;
TRUNCATE `meetings_contacts`;
TRUNCATE `meetings_users`;
TRUNCATE `memo`;
TRUNCATE `notes`;
TRUNCATE `nyutai`;
TRUNCATE `opportunities`;
TRUNCATE `opportunities_audit`;
TRUNCATE `opportunities_contacts`;
TRUNCATE `person_contacts`;
TRUNCATE `posts`;
TRUNCATE `product`;
TRUNCATE `productcategory`;
TRUNCATE `productinout`;
TRUNCATE `project`;
TRUNCATE `project_relation`;
TRUNCATE `project_task`;
TRUNCATE `project_task_audit`;
TRUNCATE `prospects`;
TRUNCATE `prospects_cstm`;
TRUNCATE `prospect_lists`;
TRUNCATE `prospect_lists_prospects`;
TRUNCATE `prospect_list_campaigns`;
TRUNCATE `releases`;
TRUNCATE `schedulers_times`;
-- TRUNCATE `session`;
TRUNCATE `smsevent`;
TRUNCATE `smsevent_instances`;
TRUNCATE `smsevent_instances_backup`;
TRUNCATE `smsgroups`;
TRUNCATE `smsgroups_module_action`;
TRUNCATE `sms_document`;
TRUNCATE `sms_event_instance`;
TRUNCATE `sms_event_instance_backup`;
TRUNCATE `sms_fee`;
TRUNCATE `sms_memo`;
TRUNCATE `sms_memo_templates`;
TRUNCATE `sms_recurrence`;
TRUNCATE `sms_recurrence_templates`;
TRUNCATE `sms_salesgroup`;
TRUNCATE `sms_syllabus`;
TRUNCATE `sms_transaction`;
TRUNCATE `tasks`;
TRUNCATE `threads`;
TRUNCATE `tracker`;
TRUNCATE `upgrade_history`;
TRUNCATE `users_feeds`;
TRUNCATE `users_last_import`;

DELETE FROM `resource` WHERE `category` NOT LIKE 'school';
DELETE FROM resource WHERE id NOT IN ('sssssss-1111', '687ec71c-1c7d-6c97-fc2a-4c889fc5d652', 'bc3a6a25-6dc7-9348-ce21-4c88a00a08ab'); 
DELETE FROM resourceschool_cstm  WHERE id_c NOT IN ('sssssss-1111', '687ec71c-1c7d-6c97-fc2a-4c889fc5d652', 'bc3a6a25-6dc7-9348-ce21-4c88a00a08ab'); 

DELETE FROM `contacts` WHERE `id` NOT IN ('c4565fc9-30f9-719c-cb31-4437354e807d', 'be59a6ae-2ceb-667f-5ba0-45b03573f1ac', '12a41c5c-d3c4-ca41-1f48-46cb93e5d433', '1b955c03-538c-558c-078b-4c88a0965234', '3dce531d-e31a-b0c7-68ed-4e570466285e');

DELETE FROM users WHERE contact_id NOT IN ('c4565fc9-30f9-719c-cb31-4437354e807d', 'be59a6ae-2ceb-667f-5ba0-45b03573f1ac','12a41c5c-d3c4-ca41-1f48-46cb93e5d433', '1b955c03-538c-558c-078b-4c88a0965234', '3dce531d-e31a-b0c7-68ed-4e570466285e');
DELETE FROM users_schools WHERE user_id  NOT IN ('c4565fc9-30f9-719c-cb31-4437354e807d', '1', 'ef256ecf-d1c4-c18a-6ade-46cb935f01ae', 'a437cc11-564c-e5c4-3ff0-4c88c6961e3b', '93c64d5b-e654-6511-88f9-4e5704efed84', '5e536a88-35fe-f2cc-d658-4e8b74a3be7b');
-- DELETE FROM users_schools WHERE school_id  NOT IN ('sssssss-1111', '687ec71c-1c7d-6c97-fc2a-4c889fc5d652', 'bc3a6a25-6dc7-9348-ce21-4c88a00a08ab');
DELETE FROM acl_roles_users WHERE user_id  NOT IN ('c4565fc9-30f9-719c-cb31-4437354e807d', '1', 'ef256ecf-d1c4-c18a-6ade-46cb935f01ae', 'a437cc11-564c-e5c4-3ff0-4c88c6961e3b', '93c64d5b-e654-6511-88f9-4e5704efed84', '5e536a88-35fe-f2cc-d658-4e8b74a3be7b');
 

-- DELETING CONTENTS OF ONLY THE EVENT AND KEIRI  RELATED TABLES
TRUNCATE `category_tree`;

TRUNCATE `course_categories_contacts`;
TRUNCATE `course_category`;

TRUNCATE `event_contacts`;
TRUNCATE `event_resource`;

TRUNCATE `homework`;

TRUNCATE `meetings`;
TRUNCATE `meetings_contacts`;
TRUNCATE `meetings_users`;

TRUNCATE `product`;
TRUNCATE `productcategory`;

TRUNCATE `smsevent`;
TRUNCATE `smsevent_instances`;

TRUNCATE `sms_event_instance`;
TRUNCATE `sms_fee`;
TRUNCATE `sms_memo`;
TRUNCATE `sms_recurrence`;

TRUNCATE `sms_salesgroup`;
TRUNCATE `sms_syllabus`;
TRUNCATE `sms_transaction`;

-- updating idnumber for branches; note that teacher (staff) id may change according to the length of idnumber (below is for 5 digit)
-- UPDATE resourceschool_cstm SET last_student_id_c='0', last_invoice_id_c='0', last_teacher_id_c='90000' WHERE 1;