]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - db/laconica_pg.sql
Merge branch '0.7.x' into 0.8.x
[quix0rs-gnu-social.git] / db / laconica_pg.sql
index d9e0c6da70fcec61f8c4c7086a38e4ce905dd301..b213bbd5021f6383822f369586857164a8731a73 100644 (file)
@@ -1,7 +1,8 @@
 /* local and remote users have profiles */\r
 \r
+create sequence profile_seq;\r
 create table profile (\r
-    id serial primary key /* comment 'unique identifier' */,\r
+    id bigint default nextval('profile_seq') primary key /* comment 'unique identifier' */,\r
     nickname varchar(64) not null /* comment 'nickname or username' */,\r
     fullname varchar(255) /* comment 'display name' */,\r
     profileurl varchar(255) /* comment 'URL, cached so we dont regenerate' */,\r
@@ -30,8 +31,9 @@ create table avatar (
 );\r
 create index avatar_profile_id_idx on avatar using btree(profile_id);\r
 \r
+create sequence sms_carrier_seq;\r
 create table sms_carrier (\r
-    id serial primary key /* comment 'primary key for SMS carrier' */,\r
+    id bigint default nextval('sms_carrier_seq') primary key /* comment 'primary key for SMS carrier' */,\r
     name varchar(64) unique /* comment 'name of the carrier' */,\r
     email_pattern varchar(255) not null /* comment 'sprintf pattern for making an email address from a phone number' */,\r
     created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,\r
@@ -101,9 +103,10 @@ create table subscription (
 create index subscription_subscriber_idx on subscription using btree(subscriber);\r
 create index subscription_subscribed_idx on subscription using btree(subscribed);\r
 \r
+create sequence notice_seq;\r
 create table notice (\r
 \r
-    id serial primary key /* comment 'unique identifier' */,\r
+    id bigint default nextval('notice_seq') primary key /* comment 'unique identifier' */,\r
     profile_id integer not null /* comment 'who made the update' */ references profile (id) ,\r
     uri varchar(255) unique /* comment 'universally unique identifier, usually a tag URI' */,\r
     content varchar(140) /* comment 'update content' */,\r
@@ -288,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' */,\r
      friendsync int not null default 2 /* comment 'friend synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming */, \r
      profilesync int not null default 1 /* comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming' */,\r
+     last_noticesync timestamp default null /* comment 'last time notices were imported' */,\r
+     last_friendsync timestamp default null /* comment 'last time friends were imported' */,\r
      created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,\r
      modified timestamp /* comment 'date this record was modified' */,\r
 \r
@@ -317,9 +322,10 @@ create table invitation (
 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 sequence message_seq;\r
 create table message (\r
 \r
-    id serial primary key /* comment 'unique identifier' */,\r
+    id bigint default nextval('message_seq') primary key /* comment 'unique identifier' */,\r
     uri varchar(255) unique /* 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
@@ -367,9 +373,10 @@ create table profile_block (
 \r
 );\r
 \r
+create sequence user_group_seq;\r
 create table user_group (\r
 \r
-    id serial primary key /* comment 'unique identifier' */,\r
+    id bigint default nextval('user_group_seq') primary key /* comment 'unique identifier' */,\r
 \r
     nickname varchar(64) unique /* comment 'nickname for addressing' */,\r
     fullname varchar(255) /* comment 'display name' */,\r
@@ -420,6 +427,64 @@ create table group_inbox (
 );\r
 create index group_inbox_created_idx on group_inbox using btree(created);\r
 \r
+\r
+/*attachments and URLs stuff */\r
+create sequence file_seq;\r
+create table file (\r
+    id bigint default nextval('file_seq') primary key /* comment 'unique identifier' */,\r
+    url varchar(255) unique, \r
+    mimetype varchar(50), \r
+    size integer, \r
+    title varchar(255), \r
+    date integer(11), \r
+    protected integer(1)\r
+);\r
+\r
+create sequence file_oembed_seq;\r
+create table file_oembed (\r
+    id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */,\r
+    file_id bigint unique,\r
+    version varchar(20),\r
+    type varchar(20),\r
+    provider varchar(50),\r
+    provider_url varchar(255),\r
+    width integer,\r
+    height integer,\r
+    html text,\r
+    title varchar(255),\r
+    author_name varchar(50), \r
+    author_url varchar(255), \r
+    url varchar(255), \r
+);\r
+\r
+create sequence file_redirection_seq;\r
+create table file_redirection (\r
+    id bigint default nextval('file_redirection_seq') primary key /* comment 'unique identifier' */,\r
+    url varchar(255) unique, \r
+    file_id bigint, \r
+    redirections integer, \r
+    httpcode integer\r
+);\r
+\r
+create sequence file_thumbnail_seq;\r
+create table file_thumbnail (\r
+    id bigint default nextval('file_thumbnail_seq') primary key /* comment 'unique identifier' */,\r
+    file_id bigint unique, \r
+    url varchar(255) unique, \r
+    width integer, \r
+    height integer \r
+);\r
+\r
+create sequence file_to_post_seq;\r
+create table file_to_post (\r
+    id bigint default nextval('file_to_post_seq') primary key /* comment 'unique identifier' */,\r
+    file_id bigint, \r
+    post_id bigint, \r
+\r
+    unique(file_id, post_id)\r
+);\r
+\r
+\r
 /* Textsearch stuff */\r
 \r
 create index textsearch_idx on profile using gist(textsearch);\r