| 155 | |
| 156 | uidx is an index into the users table, aidx is an index into the userattribute table and value is the contents of the variable. A profile is the collection of these entries for a user. |
| 157 | |
| 158 | The DB enforces the index constraints. |
| 159 | |
| 160 | Profiles for circles and projects use the tables called circleattribute and projectattribute, with the same fields (to give separate schema spaces). Circle attrubutes are assigned via the circleattributevalue table: |
| 161 | |
| 162 | ||= Field =||= Type =||= Null =||= Key =||= Default =||= Extra =|| |
| 163 | || cidx || int(11) || YES || MUL || NULL || || |
| 164 | || aidx || int(11) || YES || MUL || NULL || || |
| 165 | || value || text || YES || || NULL || || |
| 166 | |
| 167 | and projects using projectattributevalue |
| 168 | |
| 169 | ||= Field =||= Type =||= Null =||= Key =||= Default =||= Extra =|| |
| 170 | || pidx || int(11) || YES || MUL || NULL || || |
| 171 | || aidx || int(11) || YES || MUL || NULL || || |
| 172 | || value || text || YES || || NULL || || |
| 173 | |
| 174 | cidx and pidx are indices into the circles and projects tables respectively, with analogous DB constraints. |
| 175 | |
| 176 | === Circles and Projects === |
| 177 | |
| 178 | Circles and porjects are similar in implementation, differing slightly in the base tables that define them. Circles are in the circles table: |
| 179 | |
| 180 | ||= Field =||= Type =||= Null =||= Key =||= Default =||= Extra =|| |
| 181 | || idx || int(11) || NO || PRI || NULL || auto_increment || |
| 182 | || circleid || varchar(256) || YES || || NULL || || |
| 183 | || owneridx || int(11) || YES || MUL || NULL || || |
| 184 | || created || timestamp || NO || || CURRENT_TIMESTAMP || on update CURRENT_TIMESTAMP || |
| 185 | |
| 186 | This defines a circleid, owner and keeps a creation time. |
| 187 | |
| 188 | Projects are in the projects table: |
| 189 | |
| 190 | ||= Field =||= Type =||= Null =||= Key =||= Default =||= Extra =|| |
| 191 | || idx || int(11) || NO || PRI || NULL || auto_increment || |
| 192 | || projectid || varchar(256) || YES || || NULL || || |
| 193 | || owneridx || int(11) || YES || MUL || NULL || || |
| 194 | || created || timestamp || NO || || CURRENT_TIMESTAMP || on update CURRENT_TIMESTAMP || |
| 195 | || linkedidx || int(11) || YES || MUL || NULL || || |
| 196 | || flags || int(11) || NO || || 0 || || |
| 197 | |
| 198 | |
| 199 | The differences are the linkedidx field, which is an index into the circles table for the linked circle, and teh flags field that is a set of boolean attributes about a project. Right now this is only the flag for approval, which is used commonly enough and intrinsic enough to the project to be stored here rather than the profile. |
| 200 | |
| 201 | Membership in a circle is defined by the circleusers table: |
| 202 | |
| 203 | ||= Field =||= Type =||= Null =||= Key =||= Default =||= Extra =|| |
| 204 | || cidx || int(11) || NO || MUL || NULL || || |
| 205 | || uidx || int(11) || NO || MUL || NULL || || |
| 206 | || perms || int(11) || YES || || NULL || || |
| 207 | |
| 208 | This is almost exactly analogous to the notifications table. Perms is a mask of teh permissions granted to this user with respect to this circle. The indices have appropriate DB constraints as keys into circles (cidx) and users (uidx). |
| 209 | |
| 210 | Project membership is exactly analogous: |
| 211 | |
| 212 | ||= Field =||= Type =||= Null =||= Key =||= Default =||= Extra =|| |
| 213 | || pidx || int(11) || NO || MUL || NULL || || |
| 214 | || uidx || int(11) || NO || MUL || NULL || || |
| 215 | || perms || int(11) || YES || || NULL || || |
| 216 | |
| 217 | pidx is constrained as a key into projects. |
| 218 | |
| 219 | Finally circles and projects both allow joining and adding by consent of the new member and a member with ADD_USER rights. This is accomplished by putting a challenge into the database that can be redeemed by presenting the API with its ID (from a 64-bit space). |
| 220 | |
| 221 | The table holding these challenges (circlechallenge) looks like: |
| 222 | |
| 223 | |
| 224 | ||= Field =||= Type =||= Null =||= Key =||= Default =||= Extra =|| |
| 225 | || idx || bigint(20) || YES || UNI || NULL || || |
| 226 | || uidx || int(11) || YES || MUL || NULL || || |
| 227 | || cidx || int(11) || YES || MUL || NULL || || |
| 228 | || expires || datetime || YES || || NULL || || |
| 229 | || perms || int(11) || YES || || NULL || || |
| 230 | |
| 231 | uidx and cidx are links into users and circles as before. |
| 232 | |
| 233 | |
| 234 | ||= Field =||= Type =||= Null =||= Key =||= Default =||= Extra =|| |
| 235 | || idx || bigint(20) || YES || UNI || NULL || || |
| 236 | || uidx || int(11) || YES || MUL || NULL || || |
| 237 | || pidx || int(11) || YES || MUL || NULL || || |
| 238 | || expires || datetime || YES || || NULL || || |
| 239 | || perms || int(11) || YES || || NULL || || |
| 240 | |
| 241 | Projects are analogous. |