This script deprecated in favour of Database – Copy Master Lists to Shell (2014-10-13).
Makes an empty Master from current database, preserving custom fact types and source templates, Places, Master Sources and associated Repositories and Addresses, and Place/Source Media. Written for RM4 with instructions to edit for RM5.
CustomDatabaseShell.sql
There are two ways to do this:
- Use SQLite Developer with a fake RMNOCASE collation and execute the query directly on a .rmgc database. This should pose no risk as it adds nothing to the database. Moreover, RM5 is especially assured because it has the REINDEX Database Tool which will rebuild the indexes against the internal collation.
- Use other SQLite managers with the queries on Convert Database to NOCASE to create a NOCASE clone of the database. Then run CustomDatabaseShell query to depopulate the database. This NOCASE clone is usable in RM and probably will not throw up any sorting or indexing issue with the English alphabet, any more so than would the original; however, other language alphabets may be problematic. It would be advisable to add a dummy person, assign every fact, source and place to him, and drag and drop to a new database to restore the structure to RMNOCASE.
-- 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 ;