]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - db/laconica.sql
Merge branch '0.7.x' into 0.8.x
[quix0rs-gnu-social.git] / db / laconica.sql
index 15f03a978fe836ca2d648e37608af54cb849348c..a11e31692548449c4cabfd0629b589961ea577d4 100644 (file)
@@ -13,7 +13,7 @@ create table profile (
 
     index profile_nickname_idx (nickname),
     FULLTEXT(nickname, fullname, location, bio, homepage)
-) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin;
+) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
 
 create table avatar (
     profile_id integer not null comment 'foreign key to profile table' references profile (id),
@@ -50,6 +50,7 @@ create table user (
     emailnotifyfav tinyint default 1 comment 'Notify by email of favorites',
     emailnotifynudge tinyint default 1 comment 'Notify by email of nudges',
     emailnotifymsg tinyint default 1 comment 'Notify by email of direct messages',
+    emailnotifyattn tinyint default 1 comment 'Notify by email of @-replies',
     emailmicroid tinyint default 1 comment 'whether to publish email microid',
     language varchar(50) comment 'preferred language',
     timezone varchar(50) comment 'timezone',
@@ -72,7 +73,7 @@ create table user (
     modified timestamp comment 'date this record was modified',
 
     index user_smsemail_idx (smsemail)
-) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
 
 /* remote people */
 
@@ -102,7 +103,6 @@ create table subscription (
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
 create table notice (
-
     id integer auto_increment primary key comment 'unique identifier',
     profile_id integer not null comment 'who made the update' references profile (id),
     uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI',
@@ -114,11 +114,14 @@ create table notice (
     reply_to integer comment 'notice replied to (usually a guess)' references notice (id),
     is_local tinyint default 0 comment 'notice was generated by a user',
     source varchar(32) comment 'source of comment, like "web", "im", or "clientname"',
+    conversation integer comment 'id of root notice in this conversation' references notice (id),
 
     index notice_profile_id_idx (profile_id),
+    index notice_conversation_idx (conversation),
     index notice_created_idx (created),
+    index notice_replyto_idx (reply_to),
     FULLTEXT(content)
-) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin;
+) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
 
 create table notice_source (
      code varchar(32) primary key not null comment 'source code',
@@ -129,7 +132,6 @@ create table notice_source (
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
 create table reply (
-
     notice_id integer not null comment 'notice that is the reply' references notice (id),
     profile_id integer not null comment 'profile replied to' references profile (id),
     modified timestamp not null comment 'date this record was modified',
@@ -143,7 +145,6 @@ create table reply (
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
 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',
@@ -170,7 +171,7 @@ create table token (
     tok char(32) not null comment 'identifying value',
     secret char(32) not null comment 'secret value',
     type tinyint not null default 0 comment 'request or access',
-    state tinyint default 0 comment 'for requests; 0 = initial, 1 = authorized, 2 = used',
+    state tinyint default 0 comment 'for requests, 0 = initial, 1 = authorized, 2 = used',
 
     created datetime not null comment 'date this record was created',
     modified timestamp comment 'date this record was modified',
@@ -180,15 +181,14 @@ 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',
+    tok char(32) null comment 'buggy old value, ignored',
     nonce char(32) not null comment 'nonce',
     ts datetime not null comment 'timestamp sent',
 
     created datetime not null comment 'date this record was created',
     modified timestamp comment 'date this record was modified',
 
-    constraint primary key (consumer_key, tok, nonce),
-    constraint foreign key (consumer_key, tok) references token (consumer_key, tok)
+    constraint primary key (consumer_key, ts, nonce)
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
 /* One-to-many relationship of user to openid_url */
@@ -285,12 +285,14 @@ create table foreign_user (
 
 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),
+     foreign_id bigint unsigned comment 'link to user on foreign service, if exists' 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 tinyint not null default 1 comment 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies',
      friendsync tinyint not null default 2 comment 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming',
      profilesync tinyint not null default 1 comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming',
+     last_noticesync datetime default null comment 'last time notices were imported',
+     last_friendsync datetime default null comment 'last time friends were imported',
      created datetime not null comment 'date this record was created',
      modified timestamp comment 'date this record was modified',
 
@@ -321,7 +323,6 @@ create table invitation (
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
 create table message (
-
     id integer auto_increment primary key comment 'unique identifier',
     uri varchar(255) unique key comment 'universally unique identifier',
     from_profile integer not null comment 'who the message is from' references profile (id),
@@ -336,14 +337,13 @@ create table message (
     index message_from_idx (from_profile),
     index message_to_idx (to_profile),
     index message_created_idx (created)
-) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
 
 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 datetime not null comment 'date the notice was created',
-    source tinyint default 1 comment 'reason it is in the inbox; 1=subscription',
+    source tinyint default 1 comment 'reason it is in the inbox, 1=subscription',
 
     constraint primary key (user_id, notice_id),
     index notice_inbox_notice_id_idx (notice_id)
@@ -362,7 +362,6 @@ create table profile_tag (
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
 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',
@@ -372,7 +371,6 @@ create table profile_block (
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
 create table user_group (
-
     id integer auto_increment primary key comment 'unique identifier',
 
     nickname varchar(64) unique key comment 'nickname for addressing',
@@ -391,10 +389,9 @@ create table user_group (
 
     index user_group_nickname_idx (nickname)
 
-) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
 
 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 boolean default false comment 'is this user an admin?',
@@ -409,7 +406,6 @@ create table group_member (
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
 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),
 
@@ -429,3 +425,60 @@ create table group_inbox (
 
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
+create table file (
+    id integer primary key auto_increment,
+    url varchar(255), mimetype varchar(50),
+    size integer,
+    title varchar(255),
+    date integer(11),
+    protected integer(1),
+
+    unique(url)
+) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+create table file_oembed (
+    id integer primary key auto_increment,
+    file_id integer,
+    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),
+
+    unique(file_id)
+) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+create table file_redirection (
+    id integer primary key auto_increment,
+    url varchar(255),
+    file_id integer,
+    redirections integer,
+    httpcode integer,
+
+    unique(url)
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+
+create table file_thumbnail (
+    id integer primary key auto_increment,
+    file_id integer,
+    url varchar(255),
+    width integer,
+    height integer,
+
+    unique(file_id),
+    unique(url)
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+
+create table file_to_post (
+    id integer primary key auto_increment,
+    file_id integer,
+    post_id integer,
+
+    unique(file_id, post_id)
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;