-- CustomDatabaseShell.sql
-- 2011-12-09 ve3meo

/*
 DELETES all records from a DB3_NOCASE copy of a RM4/5 database
 (OR, with SQLite Developer and a fake RMNOCASE collation, all records
 from the .RMGC database file)
 except for Addresses, Config, FactTypes, GroupNames, Places, Roles, 
 Master Sources, Source Templates and associated Media thus creating
 a Master database shell.
 NOTE THE UNCOMMENT INSTRUCTION FOR USE WITH RM5
*/
BEGIN TRANSACTION ;
DELETE FROM AddressLinkTable ;
--DELETE FROM AddressTable ;
DELETE FROM ChildTable ;
DELETE FROM CitationTable ;
--DELETE FROM ConfigTable ;
DELETE FROM EventTable ;
DELETE FROM ExclusionTable ;
--DELETE FROM FactTypeTable ;
DELETE FROM FamilyTable ;
DELETE FROM GroupTable ;
--DELETE FROM LabelTable ;
DELETE FROM LinkTable ;
DELETE FROM MediaLinkTable WHERE OwnerType NOT IN (3,5) ;
DELETE FROM MultimediaTable WHERE MediaID NOT IN (SELECT MediaID FROM MediaLinkTable) ;
DELETE FROM NameTable ;
DELETE FROM PersonTable ;
--DELETE FROM PlaceTable ;
/* 
*** For RM5, UNcomment the following DELETE FROM ResearchLinkTable
*** For RM4, keep as comment 
*/
--DELETE FROM ResearchLinkTable ; 
DELETE FROM ResearchTable ;
--DELETE FROM RoleTable ;
--DELETE FROM SourceTable ;
--DELETE FROM SourceTemplateTable ;
DELETE FROM WitnessTable ;
COMMIT TRANSACTION ;





