]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - db/statusnet.sql
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x-mobile
[quix0rs-gnu-social.git] / db / statusnet.sql
1 /* local and remote users have profiles */
2
3 create table profile (
4     id integer auto_increment primary key comment 'unique identifier',
5     nickname varchar(64) not null comment 'nickname or username',
6     fullname varchar(255) comment 'display name',
7     profileurl varchar(255) comment 'URL, cached so we dont regenerate',
8     homepage varchar(255) comment 'identifying URL',
9     bio text comment 'descriptive biography',
10     location varchar(255) comment 'physical location',
11     created datetime not null comment 'date this record was created',
12     modified timestamp comment 'date this record was modified',
13
14     index profile_nickname_idx (nickname),
15     FULLTEXT(nickname, fullname, location, bio, homepage)
16 ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
17
18 create table avatar (
19     profile_id integer not null comment 'foreign key to profile table' references profile (id),
20     original boolean default false comment 'uploaded by user or generated?',
21     width integer not null comment 'image width',
22     height integer not null comment 'image height',
23     mediatype varchar(32) not null comment 'file type',
24     filename varchar(255) null comment 'local filename, if local',
25     url varchar(255) unique key comment 'avatar location',
26     created datetime not null comment 'date this record was created',
27     modified timestamp comment 'date this record was modified',
28
29     constraint primary key (profile_id, width, height),
30     index avatar_profile_id_idx (profile_id)
31 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
32
33 create table sms_carrier (
34     id integer primary key comment 'primary key for SMS carrier',
35     name varchar(64) unique key comment 'name of the carrier',
36     email_pattern varchar(255) not null comment 'sprintf pattern for making an email address from a phone number',
37     created datetime not null comment 'date this record was created',
38     modified timestamp comment 'date this record was modified'
39 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
40
41 /* local users */
42
43 create table user (
44
45     id integer primary key comment 'foreign key to profile table' references profile (id),
46     nickname varchar(64) unique key comment 'nickname or username, duped in profile',
47     password varchar(255) comment 'salted password, can be null for OpenID users',
48     email varchar(255) unique key comment 'email address for password recovery etc.',
49     incomingemail varchar(255) unique key comment 'email address for post-by-email',
50     emailnotifysub tinyint default 1 comment 'Notify by email of subscriptions',
51     emailnotifyfav tinyint default 1 comment 'Notify by email of favorites',
52     emailnotifynudge tinyint default 1 comment 'Notify by email of nudges',
53     emailnotifymsg tinyint default 1 comment 'Notify by email of direct messages',
54     emailnotifyattn tinyint default 1 comment 'Notify by email of @-replies',
55     emailmicroid tinyint default 1 comment 'whether to publish email microid',
56     language varchar(50) comment 'preferred language',
57     timezone varchar(50) comment 'timezone',
58     emailpost tinyint default 1 comment 'Post by email',
59     jabber varchar(255) unique key comment 'jabber ID for notices',
60     jabbernotify tinyint default 0 comment 'whether to send notices to jabber',
61     jabberreplies tinyint default 0 comment 'whether to send notices to jabber on replies',
62     jabbermicroid tinyint default 1 comment 'whether to publish xmpp microid',
63     updatefrompresence tinyint default 0 comment 'whether to record updates from Jabber presence notices',
64     sms varchar(64) unique key comment 'sms phone number',
65     carrier integer comment 'foreign key to sms_carrier' references sms_carrier (id),
66     smsnotify tinyint default 0 comment 'whether to send notices to SMS',
67     smsreplies tinyint default 0 comment 'whether to send notices to SMS on replies',
68     smsemail varchar(255) comment 'built from sms and carrier',
69     uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI',
70     autosubscribe tinyint default 0 comment 'automatically subscribe to users who subscribe to us',
71     urlshorteningservice varchar(50) default 'ur1.ca' comment 'service to use for auto-shortening URLs',
72     inboxed tinyint default 0 comment 'has an inbox been created for this user?',
73     design_id integer comment 'id of a design' references design(id),
74     viewdesigns tinyint default 1 comment 'whether to view user-provided designs',
75
76     created datetime not null comment 'date this record was created',
77     modified timestamp comment 'date this record was modified',
78
79     index user_smsemail_idx (smsemail)
80 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
81
82 /* remote people */
83
84 create table remote_profile (
85     id integer primary key comment 'foreign key to profile table' references profile (id),
86     uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI',
87     postnoticeurl varchar(255) comment 'URL we use for posting notices',
88     updateprofileurl varchar(255) comment 'URL we use for updates to this profile',
89     created datetime not null comment 'date this record was created',
90     modified timestamp comment 'date this record was modified'
91 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
92
93 create table subscription (
94     subscriber integer not null comment 'profile listening',
95     subscribed integer not null comment 'profile being listened to',
96     jabber tinyint default 1 comment 'deliver jabber messages',
97     sms tinyint default 1 comment 'deliver sms messages',
98     token varchar(255) comment 'authorization token',
99     secret varchar(255) comment 'token secret',
100     created datetime not null comment 'date this record was created',
101     modified timestamp comment 'date this record was modified',
102
103     constraint primary key (subscriber, subscribed),
104     index subscription_subscriber_idx (subscriber),
105     index subscription_subscribed_idx (subscribed),
106     index subscription_token_idx (token)
107 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
108
109 create table notice (
110     id integer auto_increment primary key comment 'unique identifier',
111     profile_id integer not null comment 'who made the update' references profile (id),
112     uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI',
113     content text comment 'update content',
114     rendered text comment 'HTML version of the content',
115     url varchar(255) comment 'URL of any attachment (image, video, bookmark, whatever)',
116     created datetime not null comment 'date this record was created',
117     modified timestamp comment 'date this record was modified',
118     reply_to integer comment 'notice replied to (usually a guess)' references notice (id),
119     is_local tinyint default 0 comment 'notice was generated by a user',
120     source varchar(32) comment 'source of comment, like "web", "im", or "clientname"',
121     conversation integer comment 'id of root notice in this conversation' references notice (id),
122
123     index notice_profile_id_idx (profile_id),
124     index notice_conversation_idx (conversation),
125     index notice_created_idx (created),
126     index notice_replyto_idx (reply_to),
127     FULLTEXT(content)
128 ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
129
130 create table notice_source (
131      code varchar(32) primary key not null comment 'source code',
132      name varchar(255) not null comment 'name of the source',
133      url varchar(255) not null comment 'url to link to',
134      created datetime not null comment 'date this record was created',
135      modified timestamp comment 'date this record was modified'
136 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
137
138 create table reply (
139     notice_id integer not null comment 'notice that is the reply' references notice (id),
140     profile_id integer not null comment 'profile replied to' references profile (id),
141     modified timestamp not null comment 'date this record was modified',
142     replied_id integer comment 'notice replied to (not used, see notice.reply_to)',
143
144     constraint primary key (notice_id, profile_id),
145     index reply_notice_id_idx (notice_id),
146     index reply_profile_id_idx (profile_id),
147     index reply_replied_id_idx (replied_id)
148
149 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
150
151 create table fave (
152     notice_id integer not null comment 'notice that is the favorite' references notice (id),
153     user_id integer not null comment 'user who likes this notice' references user (id),
154     modified timestamp not null comment 'date this record was modified',
155
156     constraint primary key (notice_id, user_id),
157     index fave_notice_id_idx (notice_id),
158     index fave_user_id_idx (user_id),
159     index fave_modified_idx (modified)
160
161 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
162
163 /* tables for OAuth */
164
165 create table consumer (
166     consumer_key varchar(255) primary key comment 'unique identifier, root URL',
167     seed char(32) not null comment 'seed for new tokens by this consumer',
168
169     created datetime not null comment 'date this record was created',
170     modified timestamp comment 'date this record was modified'
171 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
172
173 create table token (
174     consumer_key varchar(255) not null comment 'unique identifier, root URL' references consumer (consumer_key),
175     tok char(32) not null comment 'identifying value',
176     secret char(32) not null comment 'secret value',
177     type tinyint not null default 0 comment 'request or access',
178     state tinyint default 0 comment 'for requests, 0 = initial, 1 = authorized, 2 = used',
179
180     created datetime not null comment 'date this record was created',
181     modified timestamp comment 'date this record was modified',
182
183     constraint primary key (consumer_key, tok)
184 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
185
186 create table nonce (
187     consumer_key varchar(255) not null comment 'unique identifier, root URL',
188     tok char(32) null comment 'buggy old value, ignored',
189     nonce char(32) not null comment 'nonce',
190     ts datetime not null comment 'timestamp sent',
191
192     created datetime not null comment 'date this record was created',
193     modified timestamp comment 'date this record was modified',
194
195     constraint primary key (consumer_key, ts, nonce)
196 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
197
198 /* These are used by JanRain OpenID library */
199
200 create table oid_associations (
201     server_url BLOB,
202     handle VARCHAR(255) character set latin1,
203     secret BLOB,
204     issued INTEGER,
205     lifetime INTEGER,
206     assoc_type VARCHAR(64),
207     PRIMARY KEY (server_url(255), handle)
208 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
209
210 create table oid_nonces (
211     server_url VARCHAR(2047),
212     timestamp INTEGER,
213     salt CHAR(40),
214     UNIQUE (server_url(255), timestamp, salt)
215 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
216
217 create table confirm_address (
218     code varchar(32) not null primary key comment 'good random code',
219     user_id integer not null comment 'user who requested confirmation' references user (id),
220     address varchar(255) not null comment 'address (email, Jabber, SMS, etc.)',
221     address_extra varchar(255) not null comment 'carrier ID, for SMS',
222     address_type varchar(8) not null comment 'address type ("email", "jabber", "sms")',
223     claimed datetime comment 'date this was claimed for queueing',
224     sent datetime comment 'date this was sent for queueing',
225     modified timestamp comment 'date this record was modified'
226 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
227
228 create table remember_me (
229     code varchar(32) not null primary key comment 'good random code',
230     user_id integer not null comment 'user who is logged in' references user (id),
231     modified timestamp comment 'date this record was modified'
232 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
233
234 create table queue_item (
235
236     notice_id integer not null comment 'notice queued' references notice (id),
237     transport varchar(8) not null comment 'queue for what? "email", "jabber", "sms", "irc", ...',
238     created datetime not null comment 'date this record was created',
239     claimed datetime comment 'date this item was claimed',
240
241     constraint primary key (notice_id, transport),
242     index queue_item_created_idx (created)
243
244 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
245
246 /* Hash tags */
247 create table notice_tag (
248     tag varchar( 64 ) not null comment 'hash tag associated with this notice',
249     notice_id integer not null comment 'notice tagged' references notice (id),
250     created datetime not null comment 'date this record was created',
251
252     constraint primary key (tag, notice_id),
253     index notice_tag_created_idx (created),
254     index notice_tag_notice_id_idx (notice_id)
255 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
256
257 /* Synching with foreign services */
258
259 create table foreign_service (
260      id int not null primary key comment 'numeric key for service',
261      name varchar(32) not null unique key comment 'name of the service',
262      description varchar(255) comment 'description',
263      created datetime not null comment 'date this record was created',
264      modified timestamp comment 'date this record was modified'
265 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
266
267 create table foreign_user (
268      id bigint not null comment 'unique numeric key on foreign service',
269      service int not null comment 'foreign key to service' references foreign_service(id),
270      uri varchar(255) not null unique key comment 'identifying URI',
271      nickname varchar(255) comment 'nickname on foreign service',
272      created datetime not null comment 'date this record was created',
273      modified timestamp comment 'date this record was modified',
274
275      constraint primary key (id, service)
276 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
277
278 create table foreign_link (
279      user_id int comment 'link to user on this system, if exists' references user (id),
280      foreign_id bigint unsigned comment 'link to user on foreign service, if exists' references foreign_user(id),
281      service int not null comment 'foreign key to service' references foreign_service(id),
282      credentials varchar(255) comment 'authc credentials, typically a password',
283      noticesync tinyint not null default 1 comment 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies',
284      friendsync tinyint not null default 2 comment 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming',
285      profilesync tinyint not null default 1 comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming',
286      last_noticesync datetime default null comment 'last time notices were imported',
287      last_friendsync datetime default null comment 'last time friends were imported',
288      created datetime not null comment 'date this record was created',
289      modified timestamp comment 'date this record was modified',
290
291      constraint primary key (user_id, foreign_id, service),
292      index foreign_user_user_id_idx (user_id)
293 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
294
295 create table foreign_subscription (
296      service int not null comment 'service where relationship happens' references foreign_service(id),
297      subscriber int not null comment 'subscriber on foreign service' references foreign_user (id),
298      subscribed int not null comment 'subscribed user' references foreign_user (id),
299      created datetime not null comment 'date this record was created',
300
301      constraint primary key (service, subscriber, subscribed),
302      index foreign_subscription_subscriber_idx (subscriber),
303      index foreign_subscription_subscribed_idx (subscribed)
304 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
305
306 create table invitation (
307      code varchar(32) not null primary key comment 'random code for an invitation',
308      user_id int not null comment 'who sent the invitation' references user (id),
309      address varchar(255) not null comment 'invitation sent to',
310      address_type varchar(8) not null comment 'address type ("email", "jabber", "sms")',
311      created datetime not null comment 'date this record was created',
312
313      index invitation_address_idx (address, address_type),
314      index invitation_user_id_idx (user_id)
315 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
316
317 create table message (
318     id integer auto_increment primary key comment 'unique identifier',
319     uri varchar(255) unique key comment 'universally unique identifier',
320     from_profile integer not null comment 'who the message is from' references profile (id),
321     to_profile integer not null comment 'who the message is to' references profile (id),
322     content text comment 'message content',
323     rendered text comment 'HTML version of the content',
324     url varchar(255) comment 'URL of any attachment (image, video, bookmark, whatever)',
325     created datetime not null comment 'date this record was created',
326     modified timestamp comment 'date this record was modified',
327     source varchar(32) comment 'source of comment, like "web", "im", or "clientname"',
328
329     index message_from_idx (from_profile),
330     index message_to_idx (to_profile),
331     index message_created_idx (created)
332 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
333
334 create table notice_inbox (
335     user_id integer not null comment 'user receiving the message' references user (id),
336     notice_id integer not null comment 'notice received' references notice (id),
337     created datetime not null comment 'date the notice was created',
338     source tinyint default 1 comment 'reason it is in the inbox, 1=subscription',
339
340     constraint primary key (user_id, notice_id),
341     index notice_inbox_notice_id_idx (notice_id)
342 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
343
344 create table profile_tag (
345    tagger integer not null comment 'user making the tag' references user (id),
346    tagged integer not null comment 'profile tagged' references profile (id),
347    tag varchar(64) not null comment 'hash tag associated with this notice',
348    modified timestamp comment 'date the tag was added',
349
350    constraint primary key (tagger, tagged, tag),
351    index profile_tag_modified_idx (modified),
352    index profile_tag_tagger_tag_idx (tagger, tag),
353    index profile_tag_tagged_idx (tagged)
354 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
355
356 create table profile_block (
357    blocker integer not null comment 'user making the block' references user (id),
358    blocked integer not null comment 'profile that is blocked' references profile (id),
359    modified timestamp comment 'date of blocking',
360
361    constraint primary key (blocker, blocked)
362
363 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
364
365 create table user_group (
366     id integer auto_increment primary key comment 'unique identifier',
367
368     nickname varchar(64) unique key comment 'nickname for addressing',
369     fullname varchar(255) comment 'display name',
370     homepage varchar(255) comment 'URL, cached so we dont regenerate',
371     description text comment 'group description',
372     location varchar(255) comment 'related physical location, if any',
373
374     original_logo varchar(255) comment 'original size logo',
375     homepage_logo varchar(255) comment 'homepage (profile) size logo',
376     stream_logo varchar(255) comment 'stream-sized logo',
377     mini_logo varchar(255) comment 'mini logo',
378     design_id integer comment 'id of a design' references design(id),
379
380     created datetime not null comment 'date this record was created',
381     modified timestamp comment 'date this record was modified',
382
383     index user_group_nickname_idx (nickname)
384
385 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
386
387 create table group_member (
388     group_id integer not null comment 'foreign key to user_group' references user_group (id),
389     profile_id integer not null comment 'foreign key to profile table' references profile (id),
390     is_admin boolean default false comment 'is this user an admin?',
391
392     created datetime not null comment 'date this record was created',
393     modified timestamp comment 'date this record was modified',
394
395     constraint primary key (group_id, profile_id),
396     index group_member_profile_id_idx (profile_id),
397     index group_member_created_idx (created)
398
399 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
400
401 create table related_group (
402     group_id integer not null comment 'foreign key to user_group' references user_group (id),
403     related_group_id integer not null comment 'foreign key to user_group' references user_group (id),
404
405     created datetime not null comment 'date this record was created',
406
407     constraint primary key (group_id, related_group_id)
408
409 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
410
411 create table group_inbox (
412     group_id integer not null comment 'group receiving the message' references user_group (id),
413     notice_id integer not null comment 'notice received' references notice (id),
414     created datetime not null comment 'date the notice was created',
415
416     constraint primary key (group_id, notice_id),
417     index group_inbox_created_idx (created)
418
419 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
420
421 create table file (
422
423     id integer primary key auto_increment,
424     url varchar(255) comment 'destination URL after following redirections',
425     mimetype varchar(50) comment 'mime type of resource',
426     size integer comment 'size of resource when available',
427     title varchar(255) comment 'title of resource when available',
428     date integer(11) comment 'date of resource according to http query',
429     protected integer(1) comment 'true when URL is private (needs login)',
430     filename varchar(255) comment 'if a local file, name of the file',
431
432     modified timestamp comment 'date this record was modified',
433
434     unique(url)
435 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
436
437 create table file_oembed (
438     file_id integer primary key comment 'oEmbed for that URL/file' references file (id),
439     version varchar(20) comment 'oEmbed spec. version',
440     type varchar(20) comment 'oEmbed type: photo, video, link, rich',
441     mimetype varchar(50) comment 'mime type of resource',
442     provider varchar(50) comment 'name of this oEmbed provider',
443     provider_url varchar(255) comment 'URL of this oEmbed provider',
444     width integer comment 'width of oEmbed resource when available',
445     height integer comment 'height of oEmbed resource when available',
446     html text comment 'html representation of this oEmbed resource when applicable',
447     title varchar(255) comment 'title of oEmbed resource when available',
448     author_name varchar(50) comment 'author name for this oEmbed resource',
449     author_url varchar(255) comment 'author URL for this oEmbed resource',
450     url varchar(255) comment 'URL for this oEmbed resource when applicable (photo, link)',
451     modified timestamp comment 'date this record was modified'
452
453 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
454
455 create table file_redirection (
456
457     url varchar(255) primary key comment 'short URL (or any other kind of redirect) for file (id)',
458     file_id integer comment 'short URL for what URL/file' references file (id),
459     redirections integer comment 'redirect count',
460     httpcode integer comment 'HTTP status code (20x, 30x, etc.)',
461     modified timestamp comment 'date this record was modified'
462
463 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
464
465 create table file_thumbnail (
466
467     file_id integer primary key comment 'thumbnail for what URL/file' references file (id),
468     url varchar(255) comment 'URL of thumbnail',
469     width integer comment 'width of thumbnail',
470     height integer comment 'height of thumbnail',
471     modified timestamp comment 'date this record was modified',
472
473     unique(url)
474 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
475
476 create table file_to_post (
477
478     file_id integer comment 'id of URL/file' references file (id),
479     post_id integer comment 'id of the notice it belongs to' references notice (id),
480     modified timestamp comment 'date this record was modified',
481
482     constraint primary key (file_id, post_id)
483
484 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
485
486 create table design (
487     id integer primary key auto_increment comment 'design ID',
488     backgroundcolor integer comment 'main background color',
489     contentcolor integer comment 'content area background color',
490     sidebarcolor integer comment 'sidebar background color',
491     textcolor integer comment 'text color',
492     linkcolor integer comment 'link color',
493     backgroundimage varchar(255) comment 'background image, if any',
494     disposition tinyint default 1 comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'
495 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
496
497 create table group_block (
498    group_id integer not null comment 'group profile is blocked from' references user_group (id),
499    blocked integer not null comment 'profile that is blocked' references profile (id),
500    blocker integer not null comment 'user making the block' references user (id),
501    modified timestamp comment 'date of blocking',
502
503    constraint primary key (group_id, blocked)
504
505 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
506
507 create table group_alias (
508
509    alias varchar(64) primary key comment 'additional nickname for the group',
510    group_id integer not null comment 'group profile is blocked from' references user_group (id),
511    modified timestamp comment 'date alias was created',
512
513    index group_alias_group_id_idx (group_id)
514
515 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
516
517 create table session (
518
519     id varchar(32) primary key comment 'session ID',
520     session_data text comment 'session data',
521     created datetime not null comment 'date this record was created',
522     modified timestamp comment 'date this record was modified',
523
524     index session_modified_idx (modified)
525
526 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
527
528 create table deleted_notice (
529
530     id integer primary key comment 'identity of notice',
531     profile_id integer not null comment 'author of the notice',
532     uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI',
533     created datetime not null comment 'date the notice record was created',
534     deleted datetime not null comment 'date the notice record was created',
535
536     index deleted_notice_profile_id_idx (profile_id)
537
538 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
539
540 create table config (
541
542     section varchar(32) comment 'configuration section',
543     setting varchar(32) comment 'configuration setting',
544     value varchar(255) comment 'configuration value',
545
546     constraint primary key (section, setting)
547
548 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
549
550 create table user_role (
551
552     user_id integer not null comment 'user having the role' references user (id),
553     role    varchar(32) not null comment 'string representing the role',
554     created datetime not null comment 'date the role was granted',
555
556     constraint primary key (user_id, role)
557
558 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;