Till Westmann | fd733ee | 2014-07-10 00:57:37 -0700 | [diff] [blame] | 1 | drop dataverse TinySocial if exists; |
| 2 | create dataverse TinySocial; |
| 3 | use dataverse TinySocial; |
| 4 | |
| 5 | create type EmploymentType as open { |
| 6 | organization-name: string, |
| 7 | start-date: date, |
| 8 | end-date: date? |
| 9 | } |
| 10 | |
| 11 | create type MugshotUserType as { |
| 12 | id: int32, |
| 13 | alias: string, |
| 14 | name: string, |
| 15 | user-since: datetime, |
| 16 | address: { |
| 17 | street: string, |
| 18 | city: string, |
| 19 | state: string, |
| 20 | zip: string, |
| 21 | country: string |
| 22 | }, |
| 23 | friend-ids: {{ int32 }}, |
| 24 | employment: [EmploymentType] |
| 25 | } |
| 26 | |
| 27 | create type MugshotMessageType as closed { |
| 28 | message-id: int32, |
| 29 | author-id: int32, |
| 30 | timestamp: datetime, |
| 31 | in-response-to: int32?, |
| 32 | sender-location: point?, |
| 33 | tags: {{ string }}, |
| 34 | message: string |
| 35 | } |
| 36 | |
| 37 | create dataset MugshotUsers(MugshotUserType) |
| 38 | primary key id; |
| 39 | create dataset MugshotMessages(MugshotMessageType) |
| 40 | primary key message-id; |
| 41 | |
| 42 | create index msUserSinceIdx |
| 43 | on MugshotUsers(user-since); |
| 44 | create index msTimestampIdx |
| 45 | on MugshotMessages(timestamp); |
| 46 | create index msAuthorIdx |
| 47 | on MugshotMessages(author-id) type btree; |
| 48 | create index msSenderLocIndex |
| 49 | on MugshotMessages(sender-location) type rtree; |
| 50 | create index msMessageIdx |
| 51 | on MugshotMessages(message) type keyword; |