# How to create testdb.sql First import a "real" database snapshot in a temparary database on a non-production PC: mysql philipp_winterrodeln_wiki < philipp_winterrodeln_wiki.sql Delete unnessary tables: ```{sql} DROP TABLE IF EXISTS wrintermapsreport, wrintermapsreporthistory, wrintermapssledrun, wrmappathcache, wrmappointcache, wrreportcache, account_credentials, account_requests, actor, archive, bot_passwords, category, change_tag, change_tag_def, comment, content, content_models, dpl_clview, external_user, externallinks, filearchive, image, image_comment_temp, imagelinks, interwiki, ip_changes, ipblocks, ipblocks_restrictions, iwlinks, job, l10n_cache, langlinks, log_search, logging, math, module_deps, objectcache, oldimage, page_props, page_restrictions, pagelinks, protected_titles, querycache, querycache_info, querycachetwo, recentchanges, redirect, revision_actor_temp, revision_comment_temp, searchindex, site_identifiers, site_stats, sites, slot_roles, slots, tag_summary, templatelinks, trackbacks, transcache, updatelog, uploadstash, user_former_groups, user_groups, user_newtalk, user_openid, user_properties, valid_tag, watchlist ; ``` Should remain: ``` categorylinks page revision text user wrinncache wrregion wrregioncache wrreport wrsledruncache ``` Drop most of the rows ```{sql} DELETE FROM page WHERE page_id NOT IN ( 5, 228, 237, 251, 283, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 395, 396, 397, 761, 793, 833, 834, 835, 836, 837, 838, 839, 879, 880, 881, 882, 926, 1353, 1354, 1417, 1804 ); ``` Only keep relevant data in table `categorylinks`: ```{sql} DELETE FROM categorylinks WHERE cl_from NOT IN (SELECT page_id FROM page); DELETE FROM categorylinks WHERE cl_to NOT IN ( 'Gasthaus_(geschlossen)', 'Gasthaus', 'In_Arbeit', 'Region', 'Rodelbahn' ); ``` Only keep relevant data in table `revision`: ```{sql} DELETE FROM revision WHERE rev_page NOT IN (SELECT page_id FROM page); DELETE FROM revision WHERE rev_id NOT IN (select max(rev_id) from revision group by rev_page); ``` Only keep relevant data in table `text`: ```{sql} DELETE FROM `text` WHERE old_id NOT IN (SELECT rev_text_id FROM revision); ``` Drop all entries from table `user`: ```{sql} DELETE FROM `user`; ``` Drop entries from Winterrodeln related tables: ```{sql} DELETE FROM wrreport; DELETE FROM wrsledruncache; DELETE FROM wrinncache; DELETE FROM wrregion; DELETE FROM wrregioncache; ``` Export data to SQL: mysqldump philipp_winterrodeln_wiki --skip-extended-insert --skip-add-locks > testdb.sql