今天碰到个奇怪的问题,有同学能登录,但不能发帖,后台提示重复用户名。但是他可以发私信…
于是找了半天资料,从数据库中匹配到了一行不同用户名的数据,那一行真的没有匹配原文,但就是出现了。于是,改名再改回来,就好了。
./launcher enter app
rails dbconsole
discourse=> select * from users where username='yfzhe';
看出来是谁了吧
错误日志:
Job exception: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_username" DETAIL: Key (username)=(yfzhe) already exists.
想不到我也有学 Rails 的一天…