X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=db%2Flaconica_pg.sql;h=b213bbd5021f6383822f369586857164a8731a73;hb=7ae2ed7cfcc78992c6f6ad02be646fb935c7f6dc;hp=2d83f784a293dd388af61b0f24e7fc3b92f28b25;hpb=bab3e1b8586f42bc1f0a5f96b6990d67c6b74446;p=quix0rs-gnu-social.git diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index 2d83f784a2..b213bbd502 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -1,7 +1,8 @@ /* local and remote users have profiles */ +create sequence profile_seq; create table profile ( - id serial primary key /* comment 'unique identifier' */, + id bigint default nextval('profile_seq') primary key /* comment 'unique identifier' */, nickname varchar(64) not null /* comment 'nickname or username' */, fullname varchar(255) /* comment 'display name' */, profileurl varchar(255) /* comment 'URL, cached so we dont regenerate' */, @@ -30,8 +31,9 @@ create table avatar ( ); create index avatar_profile_id_idx on avatar using btree(profile_id); +create sequence sms_carrier_seq; create table sms_carrier ( - id serial primary key /* comment 'primary key for SMS carrier' */, + id bigint default nextval('sms_carrier_seq') primary key /* comment 'primary key for SMS carrier' */, name varchar(64) unique /* comment 'name of the carrier' */, email_pattern varchar(255) not null /* comment 'sprintf pattern for making an email address from a phone number' */, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, @@ -101,9 +103,10 @@ create table subscription ( create index subscription_subscriber_idx on subscription using btree(subscriber); create index subscription_subscribed_idx on subscription using btree(subscribed); +create sequence notice_seq; create table notice ( - id serial primary key /* comment 'unique identifier' */, + id bigint default nextval('notice_seq') primary key /* comment 'unique identifier' */, profile_id integer not null /* comment 'who made the update' */ references profile (id) , uri varchar(255) unique /* comment 'universally unique identifier, usually a tag URI' */, content varchar(140) /* comment 'update content' */, @@ -180,14 +183,13 @@ create table token ( create table nonce ( consumer_key varchar(255) not null /* comment 'unique identifier, root URL' */, tok char(32) not null /* comment 'identifying value' */, - nonce char(32) not null /* comment 'nonce' */, + nonce char(32) null /* comment 'buggy old value, ignored */, ts integer not null /* comment 'timestamp sent' values are epoch, and only used internally */, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */, - primary key (consumer_key, tok, nonce), - foreign key (consumer_key, tok) references token (consumer_key, tok) + primary key (consumer_key, ts, nonce) ); /* One-to-many relationship of user to openid_url */ @@ -289,6 +291,8 @@ create table foreign_link ( 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' */, + last_noticesync timestamp default null /* comment 'last time notices were imported' */, + last_friendsync timestamp default null /* comment 'last time friends were imported' */, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */, @@ -318,9 +322,10 @@ create table invitation ( create index invitation_address_idx on invitation using btree(address,address_type); create index invitation_user_id_idx on invitation using btree(user_id); +create sequence message_seq; create table message ( - id serial primary key /* comment 'unique identifier' */, + id bigint default nextval('message_seq') primary key /* comment 'unique identifier' */, uri varchar(255) unique /* comment 'universally unique identifier' */, from_profile integer not null /* comment 'who the message is from' */ references profile (id), to_profile integer not null /* comment 'who the message is to' */ references profile (id), @@ -368,9 +373,10 @@ create table profile_block ( ); +create sequence user_group_seq; create table user_group ( - id serial primary key /* comment 'unique identifier' */, + id bigint default nextval('user_group_seq') primary key /* comment 'unique identifier' */, nickname varchar(64) unique /* comment 'nickname for addressing' */, fullname varchar(255) /* comment 'display name' */, @@ -421,6 +427,64 @@ create table group_inbox ( ); create index group_inbox_created_idx on group_inbox using btree(created); + +/*attachments and URLs stuff */ +create sequence file_seq; +create table file ( + id bigint default nextval('file_seq') primary key /* comment 'unique identifier' */, + url varchar(255) unique, + mimetype varchar(50), + size integer, + title varchar(255), + date integer(11), + protected integer(1) +); + +create sequence file_oembed_seq; +create table file_oembed ( + id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */, + file_id bigint unique, + version varchar(20), + type varchar(20), + provider varchar(50), + provider_url varchar(255), + width integer, + height integer, + html text, + title varchar(255), + author_name varchar(50), + author_url varchar(255), + url varchar(255), +); + +create sequence file_redirection_seq; +create table file_redirection ( + id bigint default nextval('file_redirection_seq') primary key /* comment 'unique identifier' */, + url varchar(255) unique, + file_id bigint, + redirections integer, + httpcode integer +); + +create sequence file_thumbnail_seq; +create table file_thumbnail ( + id bigint default nextval('file_thumbnail_seq') primary key /* comment 'unique identifier' */, + file_id bigint unique, + url varchar(255) unique, + width integer, + height integer +); + +create sequence file_to_post_seq; +create table file_to_post ( + id bigint default nextval('file_to_post_seq') primary key /* comment 'unique identifier' */, + file_id bigint, + post_id bigint, + + unique(file_id, post_id) +); + + /* Textsearch stuff */ create index textsearch_idx on profile using gist(textsearch);