Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix database error ""Unknown column 'parent-item.author-id'" #8832

Merged
merged 2 commits into from Jun 30, 2020

Conversation

annando
Copy link
Collaborator

@annando annando commented Jun 30, 2020

Adressed here: #8473 (comment)

Copy link
Collaborator

@MrPetovan MrPetovan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the condition on lines 794-796 should be enclosed in the condition on lines 790-792 because it won't happen on its own anymore,

@tobiasd tobiasd added this to the 2020.06 milestone Jun 30, 2020
@tobiasd tobiasd added the Bug label Jun 30, 2020
@annando
Copy link
Collaborator Author

annando commented Jun 30, 2020

I think that this looks more beautiful:

		if ((strpos($sql_commands, "`parent-item`.") !== false) || (strpos($sql_commands, "`parent-item-author`.") !== false)) {
			$joins .= " STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`";
		}

		if (strpos($sql_commands, "`parent-item-author`.") !== false) {
			$joins .= " STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`";
		}

Than this:

		if ((strpos($sql_commands, "`parent-item`.") !== false) || (strpos($sql_commands, "`parent-item-author`.") !== false)) {
			$joins .= " STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`";

			if (strpos($sql_commands, "`parent-item-author`.") !== false) {
				$joins .= " STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`";
			}
		}

@MrPetovan
Copy link
Collaborator

Yes but it makes less sense since one depends on the other. The parent-item-author table alias will never be present independently from the parent-item alias so it makes sense to group them visually instead of having them separated on the same visual plan.

@MrPetovan MrPetovan merged commit b9873a8 into friendica:2020.06-rc Jun 30, 2020
@annando annando deleted the fix-db-error branch June 30, 2020 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants