Ian Maxon | 857dc13 | 2015-09-25 17:13:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
Till Westmann | fd733ee | 2014-07-10 00:57:37 -0700 | [diff] [blame] | 19 | drop dataverse TinySocial if exists; |
| 20 | create dataverse TinySocial; |
| 21 | use dataverse TinySocial; |
| 22 | |
| 23 | create type EmploymentType as open { |
| 24 | organization-name: string, |
| 25 | start-date: date, |
| 26 | end-date: date? |
| 27 | } |
| 28 | |
| 29 | create type MugshotUserType as { |
| 30 | id: int32, |
| 31 | alias: string, |
| 32 | name: string, |
| 33 | user-since: datetime, |
| 34 | address: { |
| 35 | street: string, |
| 36 | city: string, |
| 37 | state: string, |
| 38 | zip: string, |
| 39 | country: string |
| 40 | }, |
| 41 | friend-ids: {{ int32 }}, |
| 42 | employment: [EmploymentType] |
| 43 | } |
| 44 | |
| 45 | create type MugshotMessageType as closed { |
| 46 | message-id: int32, |
| 47 | author-id: int32, |
| 48 | timestamp: datetime, |
| 49 | in-response-to: int32?, |
| 50 | sender-location: point?, |
| 51 | tags: {{ string }}, |
| 52 | message: string |
| 53 | } |
| 54 | |
| 55 | create dataset MugshotUsers(MugshotUserType) |
| 56 | primary key id; |
| 57 | create dataset MugshotMessages(MugshotMessageType) |
| 58 | primary key message-id; |
| 59 | |
| 60 | create index msUserSinceIdx |
| 61 | on MugshotUsers(user-since); |
| 62 | create index msTimestampIdx |
| 63 | on MugshotMessages(timestamp); |
| 64 | create index msAuthorIdx |
| 65 | on MugshotMessages(author-id) type btree; |
| 66 | create index msSenderLocIndex |
| 67 | on MugshotMessages(sender-location) type rtree; |
| 68 | create index msMessageIdx |
| 69 | on MugshotMessages(message) type keyword; |