hey!
How do i keep only last 3 months’ data and purge the rest? Via admin console? Thanks.
The discussion revolves around purging data older than 3 months to reduce database size in a stage environment. hmmmnotsure initiated the conversation, and [pfaffman](/t/-/352137/2, /t/-/352137/4) responded by questioning the purpose and potential consequences of deleting data. pfaffman suggested using a PostDestroyer or generating bogus data with a rake task. [hmmmnotsure](/t/-/352137/3, /t/-/352137/5) clarified the goal of keeping only the last month’s data. Canapin provided a solution by referencing a rake task (dev:populate) that can generate bogus data, citing Nathan Kershaw from a different topic.
hey!
How do i keep only last 3 months’ data and purge the rest? Via admin console? Thanks.
What data? What problem are you solving?
Thank you for your reply. We are trying to see how we can reduce the db size on our stage environment.
You’d have to restore the whole database, so what’s the point? And if you deleted a bunch of data then it wouldn’t be useful as a test of what’s on production?
But there is a PostDestroyer and you could do a User.where(something).destroy_all, but that doesn’t seem very useful
What do you think you’re going to test on the staging site if it isn’t the data from production? Maybe you just want to generate some bogus data? I think there is a rake task for that.
yes, i just want last one month’s data. I dont need the rest.
Yes, there’s a task: