Difference between revisions of "User:Woozle/Friendica/2017 upgrade"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to: navigation, search
(sticking point)
(updated syntax highlighting tags)
 
Line 8: Line 8:
 
==Other Changes==
 
==Other Changes==
 
===acl_selectors===
 
===acl_selectors===
This SQL:<mysql>SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
+
This SQL:<source lang=mysql>SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
 
FROM `group`
 
FROM `group`
 
INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid`
 
INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid`
Line 15: Line 15:
 
GROUP BY `group`.`name`
 
GROUP BY `group`.`name`
 
ORDER BY `group`.`name`
 
ORDER BY `group`.`name`
LIMIT 0,100</mysql>
+
LIMIT 0,100</source>
 
...returned the following error: '''Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'icms-fka.group.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by'''.
 
...returned the following error: '''Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'icms-fka.group.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by'''.
  
Finding where this was being generated required the use of [[grep]]:<bash>grep -r "GROUP BY \`group\`.\`name\`" *.php</bash>Note that the -r option doesn't actually seem to work; I had to run this inside the "includes" folder to identify the file -- which turned out to be '''acl_selectors.php''' line 505, which I have modified thusly:<mysql>GROUP BY `group`.`name`, `group`.`id`</mysql>
+
Finding where this was being generated required the use of [[grep]]:<source lang=bash>grep -r "GROUP BY \`group\`.\`name\`" *.php</source>Note that the -r option doesn't actually seem to work; I had to run this inside the "includes" folder to identify the file -- which turned out to be '''acl_selectors.php''' line 505, which I have modified thusly:<source lang=mysql>GROUP BY `group`.`name`, `group`.`id`</source>
 
==Sticking Point==
 
==Sticking Point==
I finally got stuck -- or, perhaps I should say, decided/realized that the next step was too big of a time-investment -- when trying to figure out where and why this error was happening (Reformatted slightly for readability):
+
I finally got stuck -- or, perhaps I should say, decided/realized that the next step was too big of a time-investment -- when trying to figure out where and why this error was happening (reformatted slightly for readability):
 
<pre>
 
<pre>
 
2017-04-08 19:33:18@wrk58e93afe0cd759.83335256 [NORMAL]:dba.php:289:q DB Error (Connected) 1050: Table 'temp-addon' already exists
 
2017-04-08 19:33:18@wrk58e93afe0cd759.83335256 [NORMAL]:dba.php:289:q DB Error (Connected) 1050: Table 'temp-addon' already exists

Latest revision as of 18:29, 12 October 2019

This isn't a complete description of everything I had to do in order to get the latest Friendica working with my existing data, but it shows how I solved some of the more thorny problems.

Table Modifications

  • /contact - this is the first one I did, so notes are more explanatory
  • /item - this was a large table, and took a lot of time to do the copy
  • /gcontact
  • /notify

Other Changes

acl_selectors

This SQL:

SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
				FROM `group`
				INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid`
				WHERE NOT `group`.`deleted` AND `group`.`uid` = 1
					
				GROUP BY `group`.`name`
				ORDER BY `group`.`name`
				LIMIT 0,100

...returned the following error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'icms-fka.group.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by.

Finding where this was being generated required the use of grep:

grep -r "GROUP BY \`group\`.\`name\`" *.php

Note that the -r option doesn't actually seem to work; I had to run this inside the "includes" folder to identify the file -- which turned out to be acl_selectors.php line 505, which I have modified thusly:

GROUP BY `group`.`name`, `group`.`id`

Sticking Point

I finally got stuck -- or, perhaps I should say, decided/realized that the next step was too big of a time-investment -- when trying to figure out where and why this error was happening (reformatted slightly for readability):

2017-04-08 19:33:18@wrk58e93afe0cd759.83335256	[NORMAL]:dba.php:289:q	DB Error (Connected) 1050: Table 'temp-addon' already exists
2017-04-08 19:33:18@wrk58e93afe0cd759.83335256	[NORMAL]:dba.php:328:q	dba: CREATE TABLE `temp-addon` LIKE `addon`; returned false.
Table 'temp-addon' already exists
2017-04-08 19:33:18@wrk58e93afe0cd759.83335256	[]:dbstructure.php:25:update_fail	
 Cannot notify administrators about update_id=1216, error_message=Errors encountered performing database changes.
 ALTER TABLE `temp-addon` MODIFY `name` varchar(190) NOT NULL DEFAULT '', MODIFY `version` varchar(255) NOT NULL DEFAULT '', ADD UNIQUE INDEX `name` (`name`);<br />

I found where the error was being thrown, but would have to do some significant backtracing just to figure out what was executing the problematic SQL, and/or what was generating it... and, most importantly, why.