---
--- TABLE thread
---
-CREATE TABLE IF NOT EXISTS `thread` (
- `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
- `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
- `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
- `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
- `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
- `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
- `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
- `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
- `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
- `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
- `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
- `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
- `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
- `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
- `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
- `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
- `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
- `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
- `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
- `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
- `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
- `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
- `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
- `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
- `network` char(4) NOT NULL DEFAULT '' COMMENT '',
- `bookmark` boolean COMMENT '',
- PRIMARY KEY(`iid`),
- INDEX `uid_network_commented` (`uid`,`network`,`commented`),
- INDEX `uid_network_received` (`uid`,`network`,`received`),
- INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
- INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
- INDEX `contactid` (`contact-id`),
- INDEX `ownerid` (`owner-id`),
- INDEX `authorid` (`author-id`),
- INDEX `uid_received` (`uid`,`received`),
- INDEX `uid_commented` (`uid`,`commented`),
- INDEX `uid_wall_received` (`uid`,`wall`,`received`),
- INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`),
- INDEX `uri-id` (`uri-id`),
- FOREIGN KEY (`iid`) REFERENCES `item` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
- FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
- FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE,
- FOREIGN KEY (`contact-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
- FOREIGN KEY (`owner-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,
- FOREIGN KEY (`author-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
-) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
-