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 query on clean_discarded_statuses #17822

Merged
merged 1 commit into from
Mar 19, 2022

Conversation

tribela
Copy link
Contributor

@tribela tribela commented Mar 18, 2022

irb(main):001:0> Status.discarded.where('deleted_at <?', 30.days.ago).to_sql
=> "SELECT \"statuses\".* FROM \"statuses\" WHERE \"statuses\".\"deleted_at\" IS NULL AND \"statuses\".\"deleted_at\" IS NOT NULL AND (deleted_at <'2022-02-16 07:17:47.866763') ORDER BY \"statuses\".\"id\" DESC"
irb(main):002:0> Status.with_discarded.where('deleted_at < ?', 30.days.ago).to_sql
=> "SELECT \"statuses\".* FROM \"statuses\" WHERE (deleted_at < '2022-02-16 07:20:11.330404') ORDER BY \"statuses\".\"id\" DESC"
irb(main):020:0> Status.unscoped.discarded.to_sql
=> "SELECT \"statuses\".* FROM \"statuses\" WHERE \"statuses\".\"deleted_at\" IS NOT NULL"

Previous query contains deleted is null and deleted is not null which is completely impossible.

@tribela tribela force-pushed the fix-cleanup-worker branch from d966949 to 5d2a304 Compare March 18, 2022 07:36
@Gargron Gargron merged commit 3349cbe into mastodon:main Mar 19, 2022
@tribela tribela deleted the fix-cleanup-worker branch March 24, 2022 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants