Rake Task - Delete Records

May 2, 2019

Have sensitive data? Need to purge or remove some tables from all sensitive data? Try a custom rake task!

If you don’t know much about rake you can read a nice basic guide here

We at @Evolution utitlize a lot of different forms that save information like personal data, money, credit card forms, client information, etc. So instead of manuall writing queries to production or hacking the postgres db, try removing them safely like we do.


namespace :cc
desc "Delete creditcardforms after 6 months"
	task :remove_old => enviorment do
	CreditCardAuthorizations.delete_all ["created_at < ?", 6.months.ago]
	 puts " ...done"