Bulk deactivation of inactive users

Quick follow up. This script worked perfectly! I tested it in a demo environment first.

Two minor suggestions:

  1. I added “and active = true” to the where criteria because I wasn’t sure if there’d be side effects to deactivating an inactive user.
  2. People that come across this post is the future may want to consider adding “and id > 0” to prevent updating the system and discobot users (though I didn’t do this myself because they were within my last_seen_at window.) It doesn’t appear that their last_seen_at is updated after the accounts are created.