X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wradmin.git/blobdiff_plain/03798cba14d6d5690b2473b96291611855929902..cfe03a71290047d34800058c4230140b9768010c:/tests/testdb.md diff --git a/tests/testdb.md b/tests/testdb.md index 1a9da8d..f3e923d 100644 --- a/tests/testdb.md +++ b/tests/testdb.md @@ -5,7 +5,7 @@ First import a "real" database snapshot in a temparary database on a non-product mysql philipp_winterrodeln_wiki < philipp_winterrodeln_wiki.sql -Delete unnessary tables (execute it a few times until no more "Cannot delete or update a parent row: a foreign key constraint fails" errors occur): +Delete unnessary tables: ```{sql} DROP TABLE IF EXISTS wrintermapsreport, @@ -80,7 +80,11 @@ watchlist ; ``` -Should remain: +The command + + show tables; + +should show the following remaining tables: ``` categorylinks page @@ -165,7 +169,7 @@ DELETE FROM `text` WHERE old_id NOT IN (SELECT rev_text_id FROM revision); Drop all entries from table `user`: ```{sql} -DELETE FROM `user`; +DELETE FROM `user` WHERE user_id != 0; ``` @@ -175,11 +179,17 @@ Drop entries from Winterrodeln related tables: DELETE FROM wrreport; DELETE FROM wrsledruncache; DELETE FROM wrinncache; -DELETE FROM wrregion; DELETE FROM wrregioncache; +DELETE FROM wrregion; +``` + +Insert previously deleted values: +``` +INSERT INTO `user` VALUES (2,'RedirectBot','','','','20080925192203','','20120902200108','ea19a572ecaf2a6d5934b153e52c3ab9','20120902200103',NULL,'20120902200103','20080925192203',1,NULL); +INSERT INTO `user` VALUES (504,'Johndoe','John Doe',':pbkdf2:sha512:30000:64:hvqT9kNNazXmOigsCc4ewQ==:hytd5I3h38y7jVmqXrv6IKD1zzJYp8ZrUyodInP49VbtKWfQAOYvhmbVFCdl7JK/suPmFLKbe309/jlta2Gk4A==','',NULL,'john.doe@example.com','20191129090658','f0a018e0cf3384411373d83b212128f0',NULL,'bdb23486b4efcab13063fabacc109bae','20191206090650','20191129090650',0,NULL); ``` Export data to SQL: - mysqldump philipp_winterrodeln_wiki --skip-extended-insert --skip-add-locks > philipp_winterrodeln_wiki.sql \ No newline at end of file + mysqldump philipp_winterrodeln_wiki --skip-extended-insert --skip-add-locks > testdb.sql