X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=db%2Flaconica_pg.sql;h=cacdfa97ed84ce6d7ff8880507d25dba2978655a;hb=8408e82f928d1b159a6c9f2dd8fabd269590be61;hp=eb0dfc0ee0324241323de8919f5298b052c79296;hpb=33c13030e559a3e89a66a788e5d496c7c4fba6cd;p=quix0rs-gnu-social.git diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index eb0dfc0ee0..cacdfa97ed 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -49,8 +49,9 @@ create table "user" ( 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' */, + emailnotifymsg integer default 1 /* comment 'Notify by email of direct messages' */, + emailnotifyattn integer default 1 /* command 'Notify by email of @-replies' */, + emailmicroid integer default 1 /* comment 'whether to publish email microid' */, language varchar(50) /* comment 'preferred language' */, timezone varchar(50) /* comment 'timezone' */, emailpost integer default 1 /* comment 'Post by email' */, @@ -88,8 +89,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', + 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' */, @@ -146,7 +147,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) ); @@ -271,7 +271,7 @@ 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' */, @@ -280,15 +280,15 @@ create table foreign_user ( 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', + 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 + 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' */, @@ -300,7 +300,7 @@ create table foreign_subscription ( service int not null /* comment 'service where relationship happens' */ references foreign_service(id) , subscriber int not null /* comment 'subscriber on foreign service' */ , subscribed int not null /* comment 'subscribed user' */ , - created timestamp not null /* comment 'date this record was created' /, + created timestamp not null /* comment 'date this record was created' */, primary key (service, subscriber, subscribed) ); @@ -338,14 +338,14 @@ 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), + 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 datetime not null /* comment 'date the notice was created' */, + 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 (notice_id) on notice_inbox using btree(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), @@ -360,7 +360,7 @@ create index profile_tag_tagger_tag_idx on profile_tag using btree(tagger,tag); create table profile_block ( - blocker integer not null i/* comment 'user making the block' */ references user (id), + 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' */, @@ -368,6 +368,59 @@ create table profile_block ( ); +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);