Fix the inefficient query.

This commit is contained in:
shimamoto
2013-07-03 14:01:20 +09:00
parent aca64cf45d
commit 606e5e6e76
5 changed files with 15 additions and 19 deletions

View File

@@ -24,7 +24,7 @@ trait AccountService {
lastLoginDate = None)
def updateAccount(account: Account): Unit =
Query(Accounts)
Accounts
.filter { a => a.userName is account.userName.bind }
.map { a => a.password ~ a.mailAddress ~ a.isAdmin ~ a.url.? ~ a.registeredDate ~ a.updatedDate ~ a.lastLoginDate.? }
.update (
@@ -37,6 +37,6 @@ trait AccountService {
account.lastLoginDate)
def updateLastLoginDate(userName: String): Unit =
Query(Accounts).filter(_.userName is userName.bind).map(_.lastLoginDate).update(currentDate)
Accounts.filter(_.userName is userName.bind).map(_.lastLoginDate).update(currentDate)
}