Yeah, but doing it in Rails makes it much harder to screw up your database, like if you do it with Rails, you’ll know that you didn’t make usernames that are, say, illegal (and if some other table needs to be updated when you change the one your messing with, Rails will do it, SQL won’t).
cd /var/discourse
./launcher enter app
rails c
Now you’re in rails.
users=User.where("username like '%@%'")
users.each do |user|
user.name.gsub!(/@(.*)/,"")
puts "New name: #{user.name}"
# user.save
end
I think that’ll do what you want. If it seems like it, you can uncomment the user.save and try your luck.
Do a backup first, OK? (Or, better, on a staging server.)