create index foreign_subscription_subscriber_idx on foreign_subscription using btree(subscriber);\r
create index foreign_subscription_subscribed_idx on foreign_subscription using btree(subscribed);\r
\r
+create table invitation (\r
+ code varchar(32) not null primary key /* comment 'random code for an invitation' */,\r
+ user_id int not null /* comment 'who sent the invitation' */ references user (id),\r
+ address varchar(255) not null /* comment 'invitation sent to' */,\r
+ address_type varchar(8) not null /* comment 'address type ("email", "jabber", "sms") '*/,\r
+ created timestamp not null /* comment 'date this record was created' */\r
+\r
+);\r
+create index invitation_address_idx on invitation using btree(address,address_type);\r
+create index invitation_user_id_idx on invitation using btree(user_id);\r
+\r
+create table message (\r
+\r
+ id serial primary key /* comment 'unique identifier' */,\r
+ uri varchar(255) unique key /* comment 'universally unique identifier' */,\r
+ from_profile integer not null /* comment 'who the message is from' */ references profile (id),\r
+ to_profile integer not null /* comment 'who the message is to' */ references profile (id),\r
+ content varchar(140) /* comment 'message content' */,\r
+ rendered text /* comment 'HTML version of the content' */,\r
+ url varchar(255) /* comment 'URL of any attachment (image, video, bookmark, whatever)' */,\r
+ created timestamp not null /* comment 'date this record was created' */,\r
+ modified timestamp /* comment 'date this record was modified' */,\r
+ source varchar(32) /* comment 'source of comment, like "web", "im", or "clientname"' */\r
+ \r
+);\r
+create index message_from_idx on message using btree(from_profile);\r
+create index message_to_idx on message using btree(to_profile);\r
+create index message_created_idx on message using btree(created);\r
+\r
/* Textsearch stuff */\r
\r
create index textsearch_idx on profile using gist(textsearch);\r