| author | Tomas Zeman <tzeman@volny.cz> |
| Fri, 20 Apr 2012 08:26:22 +0200 | |
| changeset 61 | b65843860274 |
| parent 56 | 9409e7ab3f9d |
| child 73 | 4bcb7deedd3f |
| permissions | -rw-r--r-- |
| 56 | 1 |
/* |
2 |
* Copyright 2011-2012 Tomas Zeman <tzeman@volny.cz> |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
*/ |
|
16 |
package fis.aaa.model |
|
17 |
||
18 |
import fis.base.model.BaseSchema |
|
19 |
import net.liftweb.squerylrecord.RecordTypeMode._ |
|
20 |
||
21 |
/** |
|
22 |
* Database schema for users, ... |
|
23 |
*/ |
|
24 |
trait AaaSchema extends BaseSchema {
|
|
25 |
val userT = tableWithSeq[User] |
|
26 |
on(userT)(t => declare( |
|
27 |
t.login defineAs(indexed("user_login_idx")),
|
|
28 |
columns(t.deleted, t.active) are(indexed("user_deleted_active_idx"))
|
|
29 |
)) |
|
30 |
||
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
31 |
UserVendors.byId.default.set(UserCrud.get _) |
| 56 | 32 |
|
33 |
/** All existing (undeleted) users. */ |
|
34 |
val usersF = () => from(userT)(u => |
|
35 |
where(u.deleted === false) select(u) orderBy(u.name asc)) |
|
36 |
||
37 |
/** Active users. */ |
|
38 |
val activeUsersF = () => from(userT)(u => |
|
39 |
where(u.deleted === false and u.active === true) select(u) |
|
40 |
orderBy(u.name asc)) |
|
41 |
} |
|
42 |
||
43 |
object AaaSchema extends AaaSchema |
|
44 |
||
45 |
// vim: set ts=2 sw=2 et: |