
CREATE DATABASE IF NOT EXISTS parts;

GRANT ALL PRIVILEGES ON parts.* TO 'teddy'@'%';
FLUSH PRIVILEGES;

USE parts;

-- Permanent Temp Tables
DROP TABLE IF EXISTS parts.tmp_DOG_Calc_User;
-- DROP TABLE IF EXISTS parts.tmp_core_Msg_Error;
DROP TABLE IF EXISTS parts.tmp_DOG_User;
DROP TABLE IF EXISTS parts.tmp_DOG_User_Role_Link;


-- Permanent Tables
DROP TABLE IF EXISTS parts.DOG_Dog_Drive_Link_Temp;
DROP TABLE IF EXISTS parts.DOG_Dog_Drive_Link_Audit;
DROP TABLE IF EXISTS parts.DOG_Dog_Drive_Link;

DROP TABLE IF EXISTS parts.DOG_Drive_Temp;
DROP TABLE IF EXISTS parts.DOG_Drive_Audit;
DROP TABLE IF EXISTS parts.DOG_Drive;

DROP TABLE IF EXISTS parts.DOG_Command_Button_Link_Temp;
DROP TABLE IF EXISTS parts.DOG_Command_Button_Link_Audit;
DROP TABLE IF EXISTS parts.DOG_Command_Button_Link;

DROP TABLE IF EXISTS parts.DOG_Button_Icon_Temp;
DROP TABLE IF EXISTS parts.DOG_Button_Icon_Audit;
DROP TABLE IF EXISTS parts.DOG_Button_Icon;

DROP TABLE IF EXISTS parts.DOG_Image_Temp;
DROP TABLE IF EXISTS parts.DOG_Image_Audit;
DROP TABLE IF EXISTS parts.DOG_Image;

DROP TABLE IF EXISTS parts.DOG_Button_Shape_Temp;
DROP TABLE IF EXISTS parts.DOG_Button_Shape_Audit;
DROP TABLE IF EXISTS parts.DOG_Button_Shape;

DROP TABLE IF EXISTS parts.DOG_Colour_Temp;
DROP TABLE IF EXISTS parts.DOG_Colour_Audit;
DROP TABLE IF EXISTS parts.DOG_Colour;

DROP TABLE IF EXISTS parts.DOG_Location_Link_Temp;
DROP TABLE IF EXISTS parts.DOG_Location_Link_Audit;
DROP TABLE IF EXISTS parts.DOG_Location_Link;

DROP TABLE IF EXISTS parts.DOG_Location_Temp;
DROP TABLE IF EXISTS parts.DOG_Location_Audit;
DROP TABLE IF EXISTS parts.DOG_Location;

DROP TABLE IF EXISTS parts.DOG_Personal_Best_Temp;
DROP TABLE IF EXISTS parts.DOG_Personal_Best_Audit;
DROP TABLE IF EXISTS parts.DOG_Personal_Best;

DROP TABLE IF EXISTS parts.DOG_Dog_Command_Link_Temp;
DROP TABLE IF EXISTS parts.DOG_Dog_Command_Link_Audit;
DROP TABLE IF EXISTS parts.DOG_Dog_Command_Link;

DROP TABLE IF EXISTS parts.DOG_Command_Temp;
DROP TABLE IF EXISTS parts.DOG_Command_Audit;
DROP TABLE IF EXISTS parts.DOG_Command;

DROP TABLE IF EXISTS parts.DOG_Command_Category_Temp;
DROP TABLE IF EXISTS parts.DOG_Command_Category_Audit;
DROP TABLE IF EXISTS parts.DOG_Command_Category;

DROP TABLE IF EXISTS parts.DOG_Obedience_Level_Temp;
DROP TABLE IF EXISTS parts.DOG_Obedience_Level_Audit;
DROP TABLE IF EXISTS parts.DOG_Obedience_Level;

DROP TABLE IF EXISTS parts.DOG_Understanding_Level_Temp;
DROP TABLE IF EXISTS parts.DOG_Understanding_Level_Audit;
DROP TABLE IF EXISTS parts.DOG_Understanding_Level;

DROP TABLE IF EXISTS parts.DOG_Competency_Level_Temp;
DROP TABLE IF EXISTS parts.DOG_Competency_Level_Audit;
DROP TABLE IF EXISTS parts.DOG_Competency_Level;

DROP TABLE IF EXISTS parts.DOG_Dog_Breed_Link_Temp;
DROP TABLE IF EXISTS parts.DOG_Dog_Breed_Link_Audit;
DROP TABLE IF EXISTS parts.DOG_Dog_Breed_Link;

DROP TABLE IF EXISTS parts.DOG_Breed_Temp;
DROP TABLE IF EXISTS parts.DOG_Breed_Audit;
DROP TABLE IF EXISTS parts.DOG_Breed;

DROP TABLE IF EXISTS parts.DOG_Dog_Temp;
DROP TABLE IF EXISTS parts.DOG_Dog_Audit;
DROP TABLE IF EXISTS parts.DOG_Dog;

DROP TABLE IF EXISTS parts.DOG_Dog_Change_Set;

DROP TABLE IF EXISTS parts.DOG_Calc_User_Temp;

DROP TABLE IF EXISTS parts.DOG_User_Role_Link_Audit;
DROP TABLE IF EXISTS parts.DOG_User_Role_Link;

DROP TABLE IF EXISTS parts.DOG_Role_Permission_Link_Audit;
DROP TABLE IF EXISTS parts.DOG_Role_Permission_Link;

DROP TABLE IF EXISTS parts.DOG_Role_Audit;
DROP TABLE IF EXISTS parts.DOG_Role;

DROP TABLE IF EXISTS parts.DOG_User_Temp;
DROP TABLE IF EXISTS parts.DOG_User_Audit;
DROP TABLE IF EXISTS parts.DOG_User;

DROP TABLE IF EXISTS parts.DOG_Permission_Audit;
DROP TABLE IF EXISTS parts.DOG_Permission;

DROP TABLE IF EXISTS parts.DOG_Permission_Group_Audit;
DROP TABLE IF EXISTS parts.DOG_Permission_Group;

DROP TABLE IF EXISTS parts.DOG_Access_Level_Audit;
DROP TABLE IF EXISTS parts.DOG_Access_Level;

DROP TABLE IF EXISTS parts.DOG_User_Change_Set;

/*
DROP TABLE IF EXISTS parts.CORE_Split_Key_Value_Pair_Csv_Temp;
DROP TABLE IF EXISTS parts.CORE_Split_Temp;

*/
DROP TABLE IF EXISTS parts.CORE_File_Type;
DROP TABLE IF EXISTS parts.CORE_Msg_Error_Type;

-- Stored Procedures
DROP PROCEDURE IF EXISTS parts.p_DOG_test_get_many_dog_command;
DROP PROCEDURE IF EXISTS parts.p_DOG_test_get_many_command;
DROP PROCEDURE IF EXISTS parts.p_DOG_get_many_command;
DROP PROCEDURE IF EXISTS parts.p_DOG_test_save_command;
DROP PROCEDURE IF EXISTS parts.p_DOG_save_command;

DROP PROCEDURE IF EXISTS parts.p_DOG_clear_calc_user;
DROP PROCEDURE IF EXISTS parts.p_DOG_calc_user;

/*
DROP PROCEDURE IF EXISTS parts.p_core_clear_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS parts.p_core_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS parts.p_core_clear_split;
DROP PROCEDURE IF EXISTS parts.p_core_split;
DROP PROCEDURE IF EXISTS parts.p_clear_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS parts.p_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS parts.p_clear_split;
DROP PROCEDURE IF EXISTS parts.p_split;

DROP PROCEDURE IF EXISTS parts.p_core_debug_timing_reporting;
DROP PROCEDURE IF EXISTS parts.p_debug_timing_reporting;
DROP PROCEDURE IF EXISTS parts.p_core_validate_guid;
DROP PROCEDURE IF EXISTS parts.p_core_validate_guid_test;
*/