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

"Reset Stream Database" doesn't clear everything #347

Closed
powelski opened this issue Mar 19, 2014 · 4 comments · Fixed by #365
Closed

"Reset Stream Database" doesn't clear everything #347

powelski opened this issue Mar 19, 2014 · 4 comments · Fixed by #365
Labels

Comments

@powelski
Copy link

In some way, I got empty records that can't be deleted with Reset Stream Database option. I figured out that it does INNER JOIN on stream_context and stream_meta tables, so if there are no relations in either of those, this record is being skipped. It should be changed, because custom connectors might save logs without meta.

empty records

@powelski
Copy link
Author

What does type column in stream table keep by the way?

@powelski powelski added the bug label Mar 20, 2014
@fjarrett
Copy link
Contributor

@powelski It is used by other extensions, similar to a "post type", such as notification_rule.

So we don't want to delete that data, only the stream type and meta/contexts for records of that type, which is why we used the INNER JOIN.

@fjarrett
Copy link
Contributor

@powelski So I think the solution here will just be to add another DELETE statement immediately after the one we're already using, correct?

$wpdb->query( "DELETE from {$wpdb->stream} WHERE type = 'stream'" );

So we first delete stream rows with the contexts/meta tied to them, then go back through and do a cleanup in case there were any rows left that weren't tied to those other tables.

@powelski
Copy link
Author

@fjarrett LEFT JOIN is even better idea.

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 a pull request may close this issue.

2 participants