2 /* local and remote users have profiles */
\r
4 create sequence profile_seq;
\r
5 create table profile (
\r
6 id bigint default nextval('profile_seq') primary key /* comment 'unique identifier' */,
\r
7 nickname varchar(64) not null /* comment 'nickname or username' */,
\r
8 fullname varchar(255) /* comment 'display name' */,
\r
9 profileurl varchar(255) /* comment 'URL, cached so we dont regenerate' */,
\r
10 homepage varchar(255) /* comment 'identifying URL' */,
\r
11 bio varchar(140) /* comment 'descriptive biography' */,
\r
12 location varchar(255) /* comment 'physical location' */,
\r
13 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
14 modified timestamp /* comment 'date this record was modified' */,
\r
18 create index profile_nickname_idx on profile using btree(nickname);
\r
20 create table avatar (
\r
21 profile_id integer not null /* comment 'foreign key to profile table' */ references profile (id) ,
\r
22 original integer default 0 /* comment 'uploaded by user or generated?' */,
\r
23 width integer not null /* comment 'image width' */,
\r
24 height integer not null /* comment 'image height' */,
\r
25 mediatype varchar(32) not null /* comment 'file type' */,
\r
26 filename varchar(255) null /* comment 'local filename, if local' */,
\r
27 url varchar(255) unique /* comment 'avatar location' */,
\r
28 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
29 modified timestamp /* comment 'date this record was modified' */,
\r
31 primary key(profile_id, width, height)
\r
33 create index avatar_profile_id_idx on avatar using btree(profile_id);
\r
35 create sequence sms_carrier_seq;
\r
36 create table sms_carrier (
\r
37 id bigint default nextval('sms_carrier_seq') primary key /* comment 'primary key for SMS carrier' */,
\r
38 name varchar(64) unique /* comment 'name of the carrier' */,
\r
39 email_pattern varchar(255) not null /* comment 'sprintf pattern for making an email address from a phone number' */,
\r
40 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
41 modified timestamp /* comment 'date this record was modified ' */
\r
46 create table "user" (
\r
47 id integer primary key /* comment 'foreign key to profile table' */ references profile (id) ,
\r
48 nickname varchar(64) unique /* comment 'nickname or username, duped in profile' */,
\r
49 password varchar(255) /* comment 'salted password, can be null for OpenID users' */,
\r
50 email varchar(255) unique /* comment 'email address for password recovery etc.' */,
\r
51 incomingemail varchar(255) unique /* comment 'email address for post-by-email' */,
\r
52 emailnotifysub integer default 1 /* comment 'Notify by email of subscriptions' */,
\r
53 emailnotifyfav integer default 1 /* comment 'Notify by email of favorites' */,
\r
54 emailnotifynudge integer default 1 /* comment 'Notify by email of nudges' */,
\r
55 emailnotifymsg integer default 1 /* comment 'Notify by email of direct messages' */,
\r
56 emailnotifyattn integer default 1 /* command 'Notify by email of @-replies' */,
\r
57 emailmicroid integer default 1 /* comment 'whether to publish email microid' */,
\r
58 language varchar(50) /* comment 'preferred language' */,
\r
59 timezone varchar(50) /* comment 'timezone' */,
\r
60 emailpost integer default 1 /* comment 'Post by email' */,
\r
61 jabber varchar(255) unique /* comment 'jabber ID for notices' */,
\r
62 jabbernotify integer default 0 /* comment 'whether to send notices to jabber' */,
\r
63 jabberreplies integer default 0 /* comment 'whether to send notices to jabber on replies' */,
\r
64 jabbermicroid integer default 1 /* comment 'whether to publish xmpp microid' */,
\r
65 updatefrompresence integer default 0 /* comment 'whether to record updates from Jabber presence notices' */,
\r
66 sms varchar(64) unique /* comment 'sms phone number' */,
\r
67 carrier integer /* comment 'foreign key to sms_carrier' */ references sms_carrier (id) ,
\r
68 smsnotify integer default 0 /* comment 'whether to send notices to SMS' */,
\r
69 smsreplies integer default 0 /* comment 'whether to send notices to SMS on replies' */,
\r
70 smsemail varchar(255) /* comment 'built from sms and carrier' */,
\r
71 uri varchar(255) unique /* comment 'universally unique identifier, usually a tag URI' */,
\r
72 autosubscribe integer default 0 /* comment 'automatically subscribe to users who subscribe to us' */,
\r
73 urlshorteningservice varchar(50) default 'ur1.ca' /* comment 'service to use for auto-shortening URLs' */,
\r
74 inboxed integer default 0 /* comment 'has an inbox been created for this user?' */,
\r
75 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
76 modified timestamp /* comment 'date this record was modified' */
\r
79 create index user_smsemail_idx on "user" using btree(smsemail);
\r
83 create table remote_profile (
\r
84 id integer primary key /* comment 'foreign key to profile table' */ references profile (id) ,
\r
85 uri varchar(255) unique /* comment 'universally unique identifier, usually a tag URI' */,
\r
86 postnoticeurl varchar(255) /* comment 'URL we use for posting notices' */,
\r
87 updateprofileurl varchar(255) /* comment 'URL we use for updates to this profile' */,
\r
88 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
89 modified timestamp /* comment 'date this record was modified' */
\r
92 create table subscription (
\r
93 subscriber integer not null /* comment 'profile listening' */,
\r
94 subscribed integer not null /* comment 'profile being listened to' */,
\r
95 jabber integer default 1 /* comment 'deliver jabber messages' */,
\r
96 sms integer default 1 /* comment 'deliver sms messages' */,
\r
97 token varchar(255) /* comment 'authorization token' */,
\r
98 secret varchar(255) /* comment 'token secret' */,
\r
99 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
100 modified timestamp /* comment 'date this record was modified' */,
\r
102 primary key (subscriber, subscribed)
\r
104 create index subscription_subscriber_idx on subscription using btree(subscriber);
\r
105 create index subscription_subscribed_idx on subscription using btree(subscribed);
\r
107 create sequence notice_seq;
\r
108 create table notice (
\r
110 id bigint default nextval('notice_seq') primary key /* comment 'unique identifier' */,
\r
111 profile_id integer not null /* comment 'who made the update' */ references profile (id) ,
\r
112 uri varchar(255) unique /* comment 'universally unique identifier, usually a tag URI' */,
\r
113 content varchar(140) /* comment 'update content' */,
\r
114 rendered text /* comment 'HTML version of the content' */,
\r
115 url varchar(255) /* comment 'URL of any attachment (image, video, bookmark, whatever)' */,
\r
116 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
117 modified timestamp /* comment 'date this record was modified' */,
\r
118 reply_to integer /* comment 'notice replied to (usually a guess)' */ references notice (id) ,
\r
119 is_local integer default 0 /* comment 'notice was generated by a user' */,
\r
120 source varchar(32) /* comment 'source of comment, like "web", "im", or "clientname"' */,
\r
121 conversation integer /*id of root notice in this conversation' */ references notice (id)
\r
124 /* FULLTEXT(content) */
\r
126 create index notice_profile_id_idx on notice using btree(profile_id);
\r
127 create index notice_created_idx on notice using btree(created);
\r
129 create table notice_source (
\r
130 code varchar(32) primary key not null /* comment 'source code' */,
\r
131 name varchar(255) not null /* comment 'name of the source' */,
\r
132 url varchar(255) not null /* comment 'url to link to' */,
\r
133 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
134 modified timestamp /* comment 'date this record was modified' */
\r
137 create table reply (
\r
139 notice_id integer not null /* comment 'notice that is the reply' */ references notice (id) ,
\r
140 profile_id integer not null /* comment 'profile replied to' */ references profile (id) ,
\r
141 modified timestamp /* comment 'date this record was modified' */,
\r
142 replied_id integer /* comment 'notice replied to (not used, see notice.reply_to)' */,
\r
144 primary key (notice_id, profile_id)
\r
147 create index reply_notice_id_idx on reply using btree(notice_id);
\r
148 create index reply_profile_id_idx on reply using btree(profile_id);
\r
149 create index reply_replied_id_idx on reply using btree(replied_id);
\r
151 create table fave (
\r
153 notice_id integer not null /* comment 'notice that is the favorite' */ references notice (id),
\r
154 user_id integer not null /* comment 'user who likes this notice' */ references "user" (id) ,
\r
155 modified timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was modified' */,
\r
156 primary key (notice_id, user_id)
\r
159 create index fave_notice_id_idx on fave using btree(notice_id);
\r
160 create index fave_user_id_idx on fave using btree(user_id);
\r
161 create index fave_modified_idx on fave using btree(modified);
\r
163 /* tables for OAuth */
\r
165 create table consumer (
\r
166 consumer_key varchar(255) primary key /* comment 'unique identifier, root URL' */,
\r
167 seed char(32) not null /* comment 'seed for new tokens by this consumer' */,
\r
169 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
170 modified timestamp /* comment 'date this record was modified' */
\r
173 create table token (
\r
174 consumer_key varchar(255) not null /* comment 'unique identifier, root URL' */ references consumer (consumer_key),
\r
175 tok char(32) not null /* comment 'identifying value' */,
\r
176 secret char(32) not null /* comment 'secret value' */,
\r
177 type integer not null default 0 /* comment 'request or access' */,
\r
178 state integer default 0 /* comment 'for requests 0 = initial, 1 = authorized, 2 = used' */,
\r
180 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
181 modified timestamp /* comment 'date this record was modified' */,
\r
183 primary key (consumer_key, tok)
\r
186 create table nonce (
\r
187 consumer_key varchar(255) not null /* comment 'unique identifier, root URL' */,
\r
188 tok char(32) /* comment 'buggy old value, ignored' */,
\r
189 nonce char(32) null /* comment 'buggy old value, ignored */,
\r
190 ts integer not null /* comment 'timestamp sent' values are epoch, and only used internally */,
\r
192 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
193 modified timestamp /* comment 'date this record was modified' */,
\r
195 primary key (consumer_key, ts, nonce)
\r
198 /* One-to-many relationship of user to openid_url */
\r
200 create table user_openid (
\r
201 canonical varchar(255) primary key /* comment 'Canonical true URL' */,
\r
202 display varchar(255) not null unique /* comment 'URL for viewing, may be different from canonical' */,
\r
203 user_id integer not null /* comment 'user owning this URL' */ references "user" (id) ,
\r
204 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
205 modified timestamp /* comment 'date this record was modified' */
\r
208 create index user_openid_user_id_idx on user_openid using btree(user_id);
\r
210 /* These are used by JanRain OpenID library */
\r
212 create table oid_associations (
\r
213 server_url varchar(2047),
\r
214 handle varchar(255),
\r
218 assoc_type varchar(64),
\r
219 primary key (server_url, handle)
\r
222 create table oid_nonces (
\r
223 server_url varchar(2047),
\r
224 "timestamp" integer,
\r
225 salt character(40),
\r
226 unique (server_url, "timestamp", salt)
\r
229 create table confirm_address (
\r
230 code varchar(32) not null primary key /* comment 'good random code' */,
\r
231 user_id integer not null /* comment 'user who requested confirmation' */ references "user" (id),
\r
232 address varchar(255) not null /* comment 'address (email, Jabber, SMS, etc.)' */,
\r
233 address_extra varchar(255) not null default '' /* comment 'carrier ID, for SMS' */,
\r
234 address_type varchar(8) not null /* comment 'address type ("email", "jabber", "sms")' */,
\r
235 claimed timestamp /* comment 'date this was claimed for queueing' */,
\r
236 sent timestamp /* comment 'date this was sent for queueing' */,
\r
237 modified timestamp /* comment 'date this record was modified' */
\r
240 create table remember_me (
\r
241 code varchar(32) not null primary key /* comment 'good random code' */,
\r
242 user_id integer not null /* comment 'user who is logged in' */ references "user" (id),
\r
243 modified timestamp /* comment 'date this record was modified' */
\r
246 create table queue_item (
\r
248 notice_id integer not null /* comment 'notice queued' */ references notice (id) ,
\r
249 transport varchar(8) not null /* comment 'queue for what? "email", "jabber", "sms", "irc", ...' */,
\r
250 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
251 claimed timestamp /* comment 'date this item was claimed' */,
\r
253 primary key (notice_id, transport)
\r
256 create index queue_item_created_idx on queue_item using btree(created);
\r
259 create table notice_tag (
\r
260 tag varchar( 64 ) not null /* comment 'hash tag associated with this notice' */,
\r
261 notice_id integer not null /* comment 'notice tagged' */ references notice (id) ,
\r
262 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
264 primary key (tag, notice_id)
\r
266 create index notice_tag_created_idx on notice_tag using btree(created);
\r
268 /* Synching with foreign services */
\r
270 create table foreign_service (
\r
271 id int not null primary key /* comment 'numeric key for service' */,
\r
272 name varchar(32) not null unique /* comment 'name of the service' */,
\r
273 description varchar(255) /* comment 'description' */,
\r
274 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
275 modified timestamp /* comment 'date this record was modified' */
\r
278 create table foreign_user (
\r
279 id int not null unique /* comment 'unique numeric key on foreign service' */,
\r
280 service int not null /* comment 'foreign key to service' */ references foreign_service(id) ,
\r
281 uri varchar(255) not null unique /* comment 'identifying URI' */,
\r
282 nickname varchar(255) /* comment 'nickname on foreign service' */,
\r
283 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
284 modified timestamp /* comment 'date this record was modified' */,
\r
286 primary key (id, service)
\r
289 create table foreign_link (
\r
290 user_id int /* comment 'link to user on this system, if exists' */ references "user" (id),
\r
291 foreign_id int /* comment 'link' */ references foreign_user (id),
\r
292 service int not null /* comment 'foreign key to service' */ references foreign_service (id),
\r
293 credentials varchar(255) /* comment 'authc credentials, typically a password' */,
\r
294 noticesync int not null default 1 /* comment 'notice synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies' */,
\r
295 friendsync int not null default 2 /* comment 'friend synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming */,
\r
296 profilesync int not null default 1 /* comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming' */,
\r
297 last_noticesync timestamp default null /* comment 'last time notices were imported' */,
\r
298 last_friendsync timestamp default null /* comment 'last time friends were imported' */,
\r
299 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
300 modified timestamp /* comment 'date this record was modified' */,
\r
302 primary key (user_id,foreign_id,service)
\r
304 create index foreign_user_user_id_idx on foreign_link using btree(user_id);
\r
306 create table foreign_subscription (
\r
307 service int not null /* comment 'service where relationship happens' */ references foreign_service(id) ,
\r
308 subscriber int not null /* comment 'subscriber on foreign service' */ ,
\r
309 subscribed int not null /* comment 'subscribed user' */ ,
\r
310 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
312 primary key (service, subscriber, subscribed)
\r
314 create index foreign_subscription_subscriber_idx on foreign_subscription using btree(subscriber);
\r
315 create index foreign_subscription_subscribed_idx on foreign_subscription using btree(subscribed);
\r
317 create table invitation (
\r
318 code varchar(32) not null primary key /* comment 'random code for an invitation' */,
\r
319 user_id int not null /* comment 'who sent the invitation' */ references "user" (id),
\r
320 address varchar(255) not null /* comment 'invitation sent to' */,
\r
321 address_type varchar(8) not null /* comment 'address type ("email", "jabber", "sms") '*/,
\r
322 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */
\r
325 create index invitation_address_idx on invitation using btree(address,address_type);
\r
326 create index invitation_user_id_idx on invitation using btree(user_id);
\r
328 create sequence message_seq;
\r
329 create table message (
\r
331 id bigint default nextval('message_seq') primary key /* comment 'unique identifier' */,
\r
332 uri varchar(255) unique /* comment 'universally unique identifier' */,
\r
333 from_profile integer not null /* comment 'who the message is from' */ references profile (id),
\r
334 to_profile integer not null /* comment 'who the message is to' */ references profile (id),
\r
335 content varchar(140) /* comment 'message content' */,
\r
336 rendered text /* comment 'HTML version of the content' */,
\r
337 url varchar(255) /* comment 'URL of any attachment (image, video, bookmark, whatever)' */,
\r
338 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
339 modified timestamp /* comment 'date this record was modified' */,
\r
340 source varchar(32) /* comment 'source of comment, like "web", "im", or "clientname"' */
\r
343 create index message_from_idx on message using btree(from_profile);
\r
344 create index message_to_idx on message using btree(to_profile);
\r
345 create index message_created_idx on message using btree(created);
\r
347 create table notice_inbox (
\r
349 user_id integer not null /* comment 'user receiving the message' */ references "user" (id),
\r
350 notice_id integer not null /* comment 'notice received' */ references notice (id),
\r
351 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date the notice was created' */,
\r
352 source integer default 1 /* comment 'reason it is in the inbox: 1=subscription' */,
\r
354 primary key (user_id, notice_id)
\r
356 create index notice_inbox_notice_id_idx on notice_inbox using btree(notice_id);
\r
358 create table profile_tag (
\r
359 tagger integer not null /* comment 'user making the tag' */ references "user" (id),
\r
360 tagged integer not null /* comment 'profile tagged' */ references profile (id),
\r
361 tag varchar(64) not null /* comment 'hash tag associated with this notice' */,
\r
362 modified timestamp /* comment 'date the tag was added' */,
\r
364 primary key (tagger, tagged, tag)
\r
366 create index profile_tag_modified_idx on profile_tag using btree(modified);
\r
367 create index profile_tag_tagger_tag_idx on profile_tag using btree(tagger,tag);
\r
369 create table profile_block (
\r
371 blocker integer not null /* comment 'user making the block' */ references "user" (id),
\r
372 blocked integer not null /* comment 'profile that is blocked' */ references profile (id),
\r
373 modified timestamp /* comment 'date of blocking' */,
\r
375 primary key (blocker, blocked)
\r
379 create sequence design_seq;
\r
380 create table design (
\r
381 id bigint default nextval('design_seq') /* comment 'design ID'*/,
\r
382 backgroundcolor integer /* comment 'main background color'*/ ,
\r
383 contentcolor integer /*comment 'content area background color'*/ ,
\r
384 sidebarcolor integer /*comment 'sidebar background color'*/ ,
\r
385 textcolor integer /*comment 'text color'*/ ,
\r
386 linkcolor integer /*comment 'link color'*/,
\r
387 backgroundimage varchar(255) /*comment 'background image, if any'*/,
\r
388 disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/,
\r
393 create sequence user_group_seq;
\r
394 create table user_group (
\r
396 id bigint default nextval('user_group_seq') primary key /* comment 'unique identifier' */,
\r
398 nickname varchar(64) unique /* comment 'nickname for addressing' */,
\r
399 fullname varchar(255) /* comment 'display name' */,
\r
400 homepage varchar(255) /* comment 'URL, cached so we dont regenerate' */,
\r
401 description varchar(140) /* comment 'descriptive biography' */,
\r
402 location varchar(255) /* comment 'related physical location, if any' */,
\r
404 original_logo varchar(255) /* comment 'original size logo' */,
\r
405 homepage_logo varchar(255) /* comment 'homepage (profile) size logo' */,
\r
406 stream_logo varchar(255) /* comment 'stream-sized logo' */,
\r
407 mini_logo varchar(255) /* comment 'mini logo' */,
\r
408 design_id integer /*comment 'id of a design' */ references design(id),
\r
411 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
412 modified timestamp /* comment 'date this record was modified' */
\r
415 create index user_group_nickname_idx on user_group using btree(nickname);
\r
417 create table group_member (
\r
419 group_id integer not null /* comment 'foreign key to user_group' */ references user_group (id),
\r
420 profile_id integer not null /* comment 'foreign key to profile table' */ references profile (id),
\r
421 is_admin integer default 0 /* comment 'is this user an admin?' */,
\r
423 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
424 modified timestamp /* comment 'date this record was modified' */,
\r
426 primary key (group_id, profile_id)
\r
429 create table related_group (
\r
431 group_id integer not null /* comment 'foreign key to user_group' */ references user_group (id) ,
\r
432 related_group_id integer not null /* comment 'foreign key to user_group' */ references user_group (id),
\r
434 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
\r
436 primary key (group_id, related_group_id)
\r
440 create table group_inbox (
\r
441 group_id integer not null /* comment 'group receiving the message' references user_group (id) */,
\r
442 notice_id integer not null /* comment 'notice received' references notice (id) */,
\r
443 created timestamp not null default CURRENT_TIMESTAMP /* comment 'date the notice was created' */,
\r
445 primary key (group_id, notice_id)
\r
447 create index group_inbox_created_idx on group_inbox using btree(created);
\r
450 /*attachments and URLs stuff */
\r
451 create sequence file_seq;
\r
452 create table file (
\r
453 id bigint default nextval('file_seq') primary key /* comment 'unique identifier' */,
\r
454 url varchar(255) unique,
\r
455 mimetype varchar(50),
\r
457 title varchar(255),
\r
462 create sequence file_oembed_seq;
\r
463 create table file_oembed (
\r
464 id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */,
\r
465 file_id bigint unique,
\r
466 version varchar(20),
\r
468 provider varchar(50),
\r
469 provider_url varchar(255),
\r
473 title varchar(255),
\r
474 author_name varchar(50),
\r
475 author_url varchar(255),
\r
479 create sequence file_redirection_seq;
\r
480 create table file_redirection (
\r
481 id bigint default nextval('file_redirection_seq') primary key /* comment 'unique identifier' */,
\r
482 url varchar(255) unique,
\r
484 redirections integer,
\r
488 create sequence file_thumbnail_seq;
\r
489 create table file_thumbnail (
\r
490 id bigint default nextval('file_thumbnail_seq') primary key /* comment 'unique identifier' */,
\r
491 file_id bigint unique,
\r
492 url varchar(255) unique,
\r
497 create sequence file_to_post_seq;
\r
498 create table file_to_post (
\r
499 id bigint default nextval('file_to_post_seq') primary key /* comment 'unique identifier' */,
\r
503 unique(file_id, post_id)
\r
506 create table group_block (
\r
507 group_id integer not null /* comment 'group profile is blocked from' */ references user_group (id),
\r
508 blocked integer not null /* comment 'profile that is blocked' */references profile (id),
\r
509 blocker integer not null /* comment 'user making the block'*/ references "user" (id),
\r
510 modified timestamp /* comment 'date of blocking'*/ ,
\r
512 primary key (group_id, blocked)
\r
515 create table group_alias (
\r
517 alias varchar(64) /* comment 'additional nickname for the group'*/ ,
\r
518 group_id integer not null /* comment 'group profile is blocked from'*/ references user_group (id),
\r
519 modified timestamp /* comment 'date alias was created'*/,
\r
520 primary key (alias)
\r
523 create index group_alias_group_id_idx on group_alias (group_id);
\r
526 /* Textsearch stuff */
\r
528 create index textsearch_idx on profile using gist(textsearch);
\r
529 create index noticecontent_idx on notice using gist(to_tsvector('english',content));
\r
530 create trigger textsearchupdate before insert or update on profile for each row
\r
531 execute procedure tsvector_update_trigger(textsearch, 'pg_catalog.english', nickname, fullname, location, bio, homepage);
\r