1 -- Object store tables. 2 3 create table objects ( 4 store_user varchar not null, 5 object_uid varchar not null, 6 object_text varchar not null, 7 status varchar not null, -- 'active', 'cancelled' 8 primary key(store_user, object_uid) 9 ); 10 11 create table countered_objects ( 12 store_user varchar not null, 13 other varchar not null, 14 object_uid varchar not null, 15 object_text varchar not null, 16 primary key(store_user, object_uid) 17 ); 18 19 create table recurrences ( 20 store_user varchar not null, 21 object_uid varchar not null, 22 object_recurrenceid varchar not null, 23 object_text varchar not null, 24 status varchar not null, -- 'active', 'cancelled' 25 primary key(store_user, object_uid, object_recurrenceid) 26 ); 27 28 create table countered_recurrences ( 29 store_user varchar not null, 30 other varchar not null, 31 object_uid varchar not null, 32 object_recurrenceid varchar not null, 33 object_text varchar not null, 34 primary key(store_user, object_uid, object_recurrenceid) 35 ); 36 37 -- Object store free/busy details. 38 39 create table freebusy ( 40 store_user varchar not null, 41 "start" varchar not null, 42 "end" varchar not null, 43 object_uid varchar, 44 transp varchar, 45 object_recurrenceid varchar, 46 summary varchar, 47 organiser varchar 48 ); 49 50 create index freebusy_start on freebusy(store_user, "start"); 51 create index freebusy_end on freebusy(store_user, "end"); 52 53 create table freebusy_offers ( 54 store_user varchar not null, 55 "start" varchar not null, 56 "end" varchar not null, 57 object_uid varchar, 58 transp varchar, 59 object_recurrenceid varchar, 60 summary varchar, 61 organiser varchar, 62 expires varchar 63 ); 64 65 create index freebusy_offers_start on freebusy_offers(store_user, "start"); 66 create index freebusy_offers_end on freebusy_offers(store_user, "end"); 67 68 create table freebusy_other ( 69 store_user varchar not null, 70 other varchar not null, 71 "start" varchar not null, 72 "end" varchar not null, 73 object_uid varchar, 74 transp varchar, 75 object_recurrenceid varchar, 76 summary varchar, 77 organiser varchar, 78 attendee varchar -- used by quotas 79 ); 80 81 create index freebusy_other_start on freebusy_other(store_user, other, "start"); 82 create index freebusy_other_end on freebusy_other(store_user, other, "end"); 83 84 create table freebusy_providers ( 85 store_user varchar not null, 86 object_uid varchar not null, 87 object_recurrenceid varchar 88 ); 89 90 create index freebusy_providers_store_user on freebusy_providers(store_user); 91 92 create table freebusy_provider_datetimes ( 93 store_user varchar not null, 94 "start" varchar 95 ); 96 97 create index freebusy_provider_datetimes_store_user on freebusy_provider_datetimes(store_user); 98 99 -- Object store request details. 100 101 create table requests ( 102 store_user varchar not null, 103 object_uid varchar not null, 104 object_recurrenceid varchar, 105 request_type varchar 106 ); 107 108 create index requests_object_uid on requests(store_user, object_uid); 109 110 111 112 -- Journal store tables. 113 114 create table quota_delegates ( 115 quota varchar not null, 116 store_user varchar not null, 117 primary key(quota, store_user) 118 ); 119 120 -- Journal user groups and limits. 121 122 create table quota_limits ( 123 quota varchar not null, 124 user_group varchar not null, 125 quota_limit varchar not null, 126 primary key(quota, user_group) 127 ); 128 129 create table user_groups ( 130 quota varchar not null, 131 store_user varchar not null, 132 user_group varchar not null, 133 primary key(quota, store_user, user_group) 134 ); 135 136 -- Separate object store tables. 137 138 create table journal_objects ( 139 store_user varchar not null, 140 object_uid varchar not null, 141 object_text varchar not null, 142 status varchar not null, -- 'active', 'cancelled' 143 primary key(store_user, object_uid) 144 ); 145 146 create table journal_recurrences ( 147 store_user varchar not null, 148 object_uid varchar not null, 149 object_recurrenceid varchar not null, 150 object_text varchar not null, 151 status varchar not null, -- 'active', 'cancelled' 152 primary key(store_user, object_uid, object_recurrenceid) 153 ); 154 155 -- Separate object store free/busy details. 156 157 create table journal_freebusy_other ( 158 store_user varchar not null, 159 other varchar not null, 160 "start" varchar not null, 161 "end" varchar not null, 162 object_uid varchar, 163 transp varchar, 164 object_recurrenceid varchar, 165 summary varchar, 166 organiser varchar, 167 attendee varchar -- used by quotas 168 ); 169 170 create index journal_freebusy_other_start on journal_freebusy_other(store_user, other, "start"); 171 create index journal_freebusy_other_end on journal_freebusy_other(store_user, other, "end"); 172 173 create table journal_freebusy_providers ( 174 store_user varchar not null, 175 object_uid varchar not null, 176 object_recurrenceid varchar 177 ); 178 179 create index journal_freebusy_providers_store_user on journal_freebusy_providers(store_user); 180 181 create table journal_freebusy_provider_datetimes ( 182 store_user varchar not null, 183 "start" varchar 184 ); 185 186 create index journal_freebusy_provider_datetimes_store_user on journal_freebusy_provider_datetimes(store_user);