Rake drop tables with cascade
Zendesk issue: https://gitlab.zendesk.com/agent/tickets/22404
A customer reported the following error when trying to restore:
ActiveRecord::StatementInvalid: PG::DependentObjectsStillExist: ERROR: cannot drop table projects because other objects depend on it
At first I thought this was due to Rails and having Unicorn/Sidekiq still running. I think it's due to PG constraints now. Doing a cascading drop should do the trick since we want to get rid of everything anyway. I also added
IF EXISTS to avoid an issue where a cascading delete removes a table before the task loops over it.