You want to do it from Rails rather than modify the database directly.
But you could
./launcher enter app
su - postgres
psql discourse
and have at it.
You can look at Administrative Bulk Operations and, I think, find some examples that look like
users=User.where(something)
users.each do |user|
user.update(field: value)
end