For getting rid of old rows after enabling the aforementioned setting, first inspect relevant user history rows via rails console:
UserHistory.where(action: 24)
Once you’re sure that the above covers all the rows you want to ensure no longer have any user data attached in the logs, run this in the rails console:
UserHistory.where(action: 24).update_all(details: nil, email: nil)
(The “details” and “email” is what contains the personal data and will be wiped by above. Deleting the rows is not necessary for GDPR compliance, but if you want that, use delete_all.)
Run at your own risk and make backups before running database commands at scale.
You might also want to trigger a vacuum on postgresql so that any dead tuples that still have the values are actually deleted, after running the commands above.