A simpler solution might be to adjust suppress digest email after days
. They’d still be “active” but they’d stop getting notices.
But, if you want, it’s something like this:
cd /var/discourse
./launcher enter app
rails c
User.where("last_seen_at < '2016-01-01'").update_all(active: false)
exit
exit