Commit 2676f24e by utkarshcmu

Fixed user deletion in Postgres SQL

parent d7ee7cb8
......@@ -319,9 +319,14 @@ func SearchUsers(query *m.SearchUsersQuery) error {
func DeleteUser(cmd *m.DeleteUserCommand) error {
return inTransaction(func(sess *xorm.Session) error {
deletes := []string{
"DELETE FROM star WHERE user_id = ?",
"DELETE FROM user WHERE id = ?",
var deletes [2]string
if (sess.Engine.DriverName() == "postgres") {
deletes[0] = "DELETE FROM star WHERE user_id = ?"
deletes[1] = "DELETE FROM \"user\" WHERE id = ?"
} else {
deletes[0] = "DELETE FROM star WHERE user_id = ?"
deletes[1] = "DELETE FROM user WHERE id = ?"
}
for _, sql := range deletes {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment