איך למחוק נתונים שנאספו יותר מ-3 חודשים

סיכום מבוסס בינה מלאכותית

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?

תודה על התגובה שלך. אנחנו מנסים לבדוק איך ניתן להקטין את גודל מסד הנתונים בסביבת הבמה שלנו.

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, there’s a task: