X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=db%2Flaconica_pg.sql;h=9882d091a50aed16e0f0caf068ae7c0faa89ff10;hb=28e1c163e3e14b646851d7641c1c8a6a00de8fdc;hp=d027dc0af03ec86b112d14873cf23e233ff8b149;hpb=14f69f8d2efee5a927821c9a3c134cd1a682c7fe;p=quix0rs-gnu-social.git diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index d027dc0af0..9882d091a5 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -47,6 +47,9 @@ create table "user" ( email varchar(255) unique /* comment 'email address for password recovery etc.' */, incomingemail varchar(255) unique /* comment 'email address for post-by-email' */, emailnotifysub integer default 1 /* comment 'Notify by email of subscriptions' */, + emailnotifyfav integer default 1 /* comment 'Notify by email of favorites' */, + emailnotifynudge integer default 1 /* comment 'Notify by email of nudges' */, + emailnotifymsg integer default 1 /* comment 'Notify by email of direct messages' */, emailmicroid integer default 1 /* comment 'whether to publish email microid' */, language varchar(50) /* comment 'preferred language' */, timezone varchar(50) /* comment 'timezone' */, @@ -64,6 +67,7 @@ create table "user" ( uri varchar(255) unique /* comment 'universally unique identifier, usually a tag URI' */, autosubscribe integer default 0 /* comment 'automatically subscribe to users who subscribe to us' */, urlshorteningservice varchar(50) default 'ur1.ca' /* comment 'service to use for auto-shortening URLs' */, + inboxed integer default 0 /* comment 'has an inbox been created for this user?' */, created timestamp not null /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */ @@ -84,6 +88,8 @@ create table remote_profile ( create table subscription ( subscriber integer not null /* comment 'profile listening' */, subscribed integer not null /* comment 'profile being listened to' */, + jabber integer default 1 /* comment 'deliver jabber messages' */, + sms integer default 1 /* comment 'deliver sms messages' */, token varchar(255) /* comment 'authorization token' */, secret varchar(255) /* comment 'token secret' */, created timestamp not null /* comment 'date this record was created' */, @@ -140,7 +146,6 @@ create table fave ( notice_id integer not null /* comment 'notice that is the favorite' */ references notice (id), user_id integer not null /* comment 'user who likes this notice' */ references "user" (id) , modified timestamp not null /* comment 'date this record was modified' */, - primary key (notice_id, user_id) ); @@ -265,18 +270,30 @@ create table foreign_service ( ); create table foreign_user ( - id int not null /* comment 'unique numeric key on foreign service' */, + id int not null unique /* comment 'unique numeric key on foreign service' */, service int not null /* comment 'foreign key to service' */ references foreign_service(id) , uri varchar(255) not null unique /* comment 'identifying URI' */, nickname varchar(255) /* comment 'nickname on foreign service' */, - user_id int /* comment 'link to user on this system, if exists' */ references "user" (id), - credentials varchar(255) /* comment 'authc credentials, typically a password' */, created timestamp not null /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */, primary key (id, service) ); -create index foreign_user_user_id_idx on foreign_user using btree(user_id); + +create table foreign_link ( + user_id int /* comment 'link to user on this system, if exists' */ references "user" (id), + foreign_id int /* comment 'link' */ references foreign_user (id), + service int not null /* comment 'foreign key to service' */ references foreign_service (id), + credentials varchar(255) /* comment 'authc credentials, typically a password' */, + noticesync int not null default 1 /* comment 'notice synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies' */, + friendsync int not null default 2 /* comment 'friend synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming */, + profilesync int not null default 1 /* comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming' */, + created timestamp not null /* comment 'date this record was created' */, + modified timestamp not null /* comment 'date this record was modified' */, + + primary key (user_id,foreign_id,service) +); +create index foreign_user_user_id_idx on foreign_link using btree(user_id); create table foreign_subscription ( service int not null /* comment 'service where relationship happens' */ references foreign_service(id) , @@ -318,6 +335,91 @@ create index message_from_idx on message using btree(from_profile); create index message_to_idx on message using btree(to_profile); create index message_created_idx on message using btree(created); +create table notice_inbox ( + + user_id integer not null /* comment 'user receiving the message' */ references "user" (id), + notice_id integer not null /* comment 'notice received' */ references notice (id), + created timestamp not null /* comment 'date the notice was created' */, + source integer default 1 /* comment 'reason it is in the inbox; 1=subscription' */, + + primary key (user_id, notice_id) +); +create index notice_inbox_notice_id_idx on notice_inbox using btree(notice_id); + +create table profile_tag ( + tagger integer not null /* comment 'user making the tag' */ references "user" (id), + tagged integer not null /* comment 'profile tagged' */ references profile (id), + tag varchar(64) not null /* comment 'hash tag associated with this notice' */, + modified timestamp /* comment 'date the tag was added' */, + + primary key (tagger, tagged, tag) +); +create index profile_tag_modified_idx on profile_tag using btree(modified); +create index profile_tag_tagger_tag_idx on profile_tag using btree(tagger,tag); + +create table profile_block ( + + blocker integer not null /* comment 'user making the block' */ references "user" (id), + blocked integer not null /* comment 'profile that is blocked' */ references profile (id), + modified timestamp /* comment 'date of blocking' */, + + primary key (blocker, blocked) + +); + +create table user_group ( + + id serial primary key /* comment 'unique identifier' */, + + nickname varchar(64) unique /* comment 'nickname for addressing' */, + fullname varchar(255) /* comment 'display name' */, + homepage varchar(255) /* comment 'URL, cached so we dont regenerate' */, + description varchar(140) /* comment 'descriptive biography' */, + location varchar(255) /* comment 'related physical location, if any' */, + + original_logo varchar(255) /* comment 'original size logo' */, + homepage_logo varchar(255) /* comment 'homepage (profile) size logo' */, + stream_logo varchar(255) /* comment 'stream-sized logo' */, + mini_logo varchar(255) /* comment 'mini logo' */, + + created timestamp not null /* comment 'date this record was created' */, + modified timestamp /* comment 'date this record was modified' */ + +); +create index user_group_nickname_idx on user_group using btree(nickname); + +create table group_member ( + + group_id integer not null /* comment 'foreign key to user_group' */ references user_group (id), + profile_id integer not null /* comment 'foreign key to profile table' */ references profile (id), + is_admin integer default 0 /* comment 'is this user an admin?' */, + + created timestamp not null /* comment 'date this record was created' */, + modified timestamp /* comment 'date this record was modified' */, + + primary key (group_id, profile_id) +); + +create table related_group ( + + group_id integer not null /* comment 'foreign key to user_group' */ references user_group (id) , + related_group_id integer not null /* comment 'foreign key to user_group' */ references user_group (id), + + created timestamp not null /* comment 'date this record was created' */, + + primary key (group_id, related_group_id) + +); + +create table group_inbox ( + group_id integer not null /* comment 'group receiving the message' references user_group (id) */, + notice_id integer not null /* comment 'notice received' references notice (id) */, + created timestamp not null /* comment 'date the notice was created' */, + + primary key (group_id, notice_id) +); +create index group_inbox_created_idx on group_inbox using btree(created); + /* Textsearch stuff */ create index textsearch_idx on profile using gist(textsearch);