Changes between Version 1 and Version 2 of NewImplNotes


Ignore:
Timestamp:
Aug 20, 2013 1:55:03 PM (7 years ago)
Author:
faber
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewImplNotes

    v1 v2  
    153153|| aidx || int(11) || YES || MUL || NULL || ||
    154154|| value || text || YES || || NULL || ||
     155
     156uidx 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
     158The DB enforces the index constraints.
     159
     160Profiles 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
     167and 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
     174cidx and pidx are indices into the circles and projects tables respectively, with analogous DB constraints.
     175
     176=== Circles and Projects ===
     177
     178Circles 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
     186This defines a circleid, owner and keeps a creation time.
     187
     188Projects 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
     199The 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
     201Membership 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
     208This 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
     210Project 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
     217pidx is constrained as a key into projects.
     218
     219Finally 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
     221The 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
     231uidx 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
     241Projects are analogous.