]> git.mxchange.org Git - friendica.git/blobdiff - doc/Update.md
Merge pull request #13368 from MrPetovan/bug/13367-post-plink
[friendica.git] / doc / Update.md
index c4fe16186380c011d539b895e51baed3d93a2422..40de14082c30008977b0d63cabfe09a31278c25d 100644 (file)
@@ -10,8 +10,10 @@ If you installed Friendica in the ``path/to/friendica`` folder:
 1. Unpack the new Friendica archive in ``path/to/friendica_new``.
 2. Copy  the following items from ``path/to/friendica`` to ``path/to/friendica_new``:
    * ``config/local.config.php``
-   * ``proxy/``   
-The following items only need to be copied if they are located inside your friendica path:
+   * ``proxy/``
+   * ``.htaccess`` if using Apache web server
+
+    The following items only need to be copied if they are located inside your friendica path:
    * your storage folder as set in **Admin -> Site -> File Upload -> Storage base path** 
    * your item cache as set in **Admin -> Site -> Performance -> Path to item cache**
    * your temp folder as set in **Admin -> Site -> Advanced -> Temp path**
@@ -77,3 +79,29 @@ RENAME TABLE <table_name>_new TO <table_name>;
 ```
 
 This method is slower overall, but it is better suited for large numbers of duplicates.
+
+### Resolving Possible Database Issues Post Upgrading
+
+#### Foreign Keys
+
+Some of the updates include the use of foreign keys now that will bump into issues with previous versions, which would sometimes shove bad data into tables, preventing, causing errors such as below.
+
+```
+Error 1452 occurred during database update:
+Cannot add or update a child row: a foreign key constraint fails (`friendica`.`#sql-10ea6_5a6d`, CONSTRAINT `#sql-10ea6_5a6d_ibfk_1` FOREIGN KEY (`contact-id`) REFERENCES `contact` (`id`))
+ALTER TABLE `thread` ADD FOREIGN KEY (`iid`) REFERENCES `item` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE; 
+```
+
+All current known fixes for possible items that can go wrong are as below.
+
+```SQL
+DELETE FROM `item` WHERE `owner-id` NOT IN (SELECT `id` FROM `contact`);
+DELETE FROM `item` WHERE `contact-id` NOT IN (SELECT `id` FROM `contact`);
+DELETE FROM `notify` WHERE `uri-id` NOT IN (SELECT `id` FROM `item-uri`);
+DELETE FROM `photo` WHERE `contact-id` NOT IN (SELECT `id` FROM `contact`);
+DELETE FROM `thread` WHERE `iid` NOT IN (SELECT `id` FROM `item`);
+DELETE FROM `item` WHERE `author-id` NOT IN (SELECT `id` FROM `contact`);
+DELETE FROM `diaspora-interaction` WHERE `uri-id` NOT IN (SELECT `id` FROM `item-uri`);
+```
+
+This all has been compiled as of currently from issue #9746, #9753, and #9878.