Commit fe2d8f1e by utkarshcmu

Used dialect for postgres

parent 2676f24e
......@@ -319,15 +319,10 @@ func SearchUsers(query *m.SearchUsersQuery) error {
func DeleteUser(cmd *m.DeleteUserCommand) error {
return inTransaction(func(sess *xorm.Session) error {
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 = ?"
}
deletes := []string{
"DELETE FROM star WHERE user_id = ?",
"DELETE FROM " + dialect.Quote("user") + " WHERE id = ?",
}
for _, sql := range deletes {
_, err := sess.Exec(sql, cmd.UserId)
......
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