Suspend all users apart from admin users for development copy

Cheers, I know my way around MySQL…

FWIW that should be:

su - postgres

Or:

sudo -iu postgres

So I worked out how to select admin users:

discourse=# SELECT FROM users WHERE admin='t';
--
(6 rows)

And then tried:

discourse=# UPDATE users
discourse-# SET silenced_till = '3019-02-01 13:00:00,'
discourse-# SET suspended_till = '3019-02-01 13:00:00'
discourse-# WHERE admin='f'
discourse-# RETURNING id, username_lower;
ERROR:  syntax error at or near "SET"
LINE 3: SET suspended_till = '3019-02-01 13:00:00'
        ^

However this works:

discourse=# UPDATE users
discourse-# SET silenced_till = '3019-02-01 13:00:00', suspended_till = '3019-02-01 13:00:00'
discourse-# WHERE admin='f'
discourse-# RETURNING id, username_lower;

Thanks for your help with this @slackmoehrle :slight_smile: .

Ahh! Yes, I had missed that, this is perfect, thanks.