Commit fe2d8f1e by utkarshcmu

Used dialect for postgres

parent 2676f24e
...@@ -319,14 +319,9 @@ func SearchUsers(query *m.SearchUsersQuery) error { ...@@ -319,14 +319,9 @@ func SearchUsers(query *m.SearchUsersQuery) error {
func DeleteUser(cmd *m.DeleteUserCommand) error { func DeleteUser(cmd *m.DeleteUserCommand) error {
return inTransaction(func(sess *xorm.Session) error { return inTransaction(func(sess *xorm.Session) error {
var deletes [2]string deletes := []string{
"DELETE FROM star WHERE user_id = ?",
if (sess.Engine.DriverName() == "postgres") { "DELETE FROM " + dialect.Quote("user") + " WHERE id = ?",
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 { 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