CREATE TABLE `api_tokens` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`active` tinyint(1) NOT NULL,
`user_id` int(11) NOT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_api_tokens_on_uuid` (`uuid`),
KEY `index_api_tokens_on_user_id` (`user_id`)
);
CREATE TABLE `archive_agreements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mokum_username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`frf_username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`user_id` int(11) NOT NULL,
`frf_user_id` int(11) NOT NULL,
`agreed` tinyint(1) NOT NULL,
`public` tinyint(1) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_archive_agreements_on_frf_username` (`frf_username`),
UNIQUE KEY `index_archive_agreements_on_frf_user_id` (`frf_user_id`),
KEY `index_archive_agreements_on_user_id` (`user_id`),
KEY `index_archive_agreements_on_mokum_username` (`mokum_username`)
);
CREATE TABLE `banned_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`banned_user_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_banned_users_on_user_id_and_banned_user_id` (`user_id`,`banned_user_id`),
KEY `index_banned_users_on_banned_user_id` (`banned_user_id`)
);
CREATE TABLE `clikes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`comment_id` int(11) NOT NULL,
`created_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_clikes_on_post_id_and_user_id_and_comment_id` (`post_id`,`user_id`,`comment_id`),
KEY `index_clikes_on_user_id` (`user_id`)
);
CREATE TABLE `comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`realm` int(11) NOT NULL DEFAULT '0',
`external_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_comments_on_external_id_and_post_id` (`external_id`,`post_id`),
KEY `index_comments_on_user_id` (`user_id`),
KEY `index_comments_on_post_id_and_user_id` (`post_id`,`user_id`),
KEY `index_comments_on_post_id_and_created_at` (`post_id`,`created_at`)
);
CREATE TABLE `current_stats` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`metric` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`value` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `index_current_stats_on_metric_and_created_at` (`metric`,`created_at`)
);
CREATE TABLE `duplicates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`object_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_duplicates_on_uuid` (`uuid`),
KEY `index_duplicates_on_created_at` (`created_at`)
);
CREATE TABLE `embeds` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`post_id` int(11) NOT NULL,
`source` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`text_orig` text COLLATE utf8_unicode_ci NOT NULL,
`json` text COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `index_embeds_on_user_id` (`user_id`),
KEY `index_embeds_on_post_id` (`post_id`)
);
CREATE TABLE `favs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_favs_on_post_id_and_user_id` (`post_id`,`user_id`),
KEY `index_favs_on_user_id` (`user_id`)
);
CREATE TABLE `feed_calendars` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`timeline_id` int(11) NOT NULL,
`post_id` int(11) NOT NULL,
`date_month` int(11) NOT NULL,
`date_week` int(11) NOT NULL,
`date_day` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_feed_calendars_on_timeline_id_and_post_id` (`timeline_id`,`post_id`),
KEY `index_feed_calendars_on_timeline_id_and_date_month` (`timeline_id`,`date_month`),
KEY `index_feed_calendars_on_timeline_id_and_date_week` (`timeline_id`,`date_week`),
KEY `index_feed_calendars_on_timeline_id_and_date_day` (`timeline_id`,`date_day`),
KEY `index_feed_calendars_on_post_id` (`post_id`)
);
CREATE TABLE `forbidden_archive_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`frf_username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_forbidden_archive_users_on_frf_username` (`frf_username`)
);
CREATE TABLE `frf_comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`frf_post_id` int(11) NOT NULL,
`frf_user_id` int(11) NOT NULL,
`body` text COLLATE utf8_unicode_ci NOT NULL,
`md5_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`published_at` datetime DEFAULT NULL,
`created_at` datetime(6) NOT NULL,
`comment_id` int(11) DEFAULT NULL,
`wordcount` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_frf_comments_on_md5_id_and_frf_post_id_and_frf_user_id` (`md5_id`,`frf_post_id`,`frf_user_id`),
UNIQUE KEY `index_frf_comments_on_comment_id` (`comment_id`),
KEY `index_frf_comments_on_frf_post_id_and_published_at` (`frf_post_id`,`published_at`),
KEY `index_frf_comments_on_frf_user_id` (`frf_user_id`)
);
CREATE TABLE `frf_files` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`frf_post_id` int(11) NOT NULL,
`url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`media_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`filename` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`size` int(11) NOT NULL,
`created_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_frf_files_on_url_and_frf_post_id` (`url`,`frf_post_id`),
KEY `index_frf_files_on_frf_post_id` (`frf_post_id`)
);
CREATE TABLE `frf_images` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`frf_post_id` int(11) NOT NULL,
`url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`link` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,
`filename` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime(6) NOT NULL,
`file_file_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`file_content_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`file_file_size` int(11) DEFAULT NULL,
`file_updated_at` datetime DEFAULT NULL,
`attachment_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_frf_images_on_frf_post_id_and_url` (`frf_post_id`,`url`),
UNIQUE KEY `index_frf_images_on_attachment_id` (`attachment_id`),
KEY `url` (`url`)
);
CREATE TABLE `frf_likes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`frf_post_id` int(11) NOT NULL,
`frf_user_id` int(11) NOT NULL,
`liked_at` datetime DEFAULT NULL,
`created_at` datetime(6) NOT NULL,
`like_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_frf_likes_on_frf_post_id_and_frf_user_id` (`frf_post_id`,`frf_user_id`),
UNIQUE KEY `index_frf_likes_on_like_id` (`like_id`),
KEY `index_frf_likes_on_frf_user_id` (`frf_user_id`)
);
CREATE TABLE `frf_posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`frf_user_id` int(11) NOT NULL,
`body` text COLLATE utf8_unicode_ci NOT NULL,
`url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`published_at` datetime NOT NULL,
`md5_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`via_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`via_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_frf_posts_on_md5_id` (`md5_id`),
UNIQUE KEY `index_frf_posts_on_url` (`url`),
KEY `index_frf_posts_on_frf_user_id_and_published_at` (`frf_user_id`,`published_at`),
KEY `index_frf_posts_on_via_url` (`via_url`)
);
CREATE TABLE `frf_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_frf_users_on_name` (`name`)
);
CREATE TABLE `friendfeed_archives` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_friendfeed_archives_on_username` (`username`)
);
CREATE TABLE `group_admins` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_group_admins_on_group_id_and_user_id` (`group_id`,`user_id`),
KEY `index_group_admins_on_user_id` (`user_id`)
);
CREATE TABLE `group_avatars` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`avatar_json` text,
PRIMARY KEY (`id`)
);
CREATE TABLE `group_only_admins` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
);
CREATE TABLE `groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL,
`nsfw` tinyint(1) NOT NULL DEFAULT '0',
`avatar_szi_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_groups_on_name` (`name`)
);
CREATE TABLE `hidden_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`hidden_by` int(11) NOT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `index_hidden_users_on_user_id` (`user_id`),
KEY `index_hidden_users_on_hidden_by` (`hidden_by`)
);
CREATE TABLE `historic_tier_updates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`version` int(11) NOT NULL,
`tier0_ms` int(11) NOT NULL,
`tier1_ms` int(11) NOT NULL,
`tier2_ms` int(11) NOT NULL,
`originally_created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_historic_tier_updates_on_post_id_and_version` (`post_id`,`version`)
);
CREATE TABLE `ignored_archive_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ignored` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
);
CREATE TABLE `import_tokens` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`feed_name` varchar(255) NOT NULL,
`feed_display_name` varchar(255) DEFAULT NULL,
`uuid_token` varchar(255) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`created_at` datetime(6) NOT NULL,
`updated_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_import_tokens_on_uuid_token` (`uuid_token`),
UNIQUE KEY `index_import_tokens_on_user_id_and_feed_name` (`user_id`,`feed_name`)
);
CREATE TABLE `imported_posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`open_graph_id` int(11) NOT NULL,
`post_id` int(11) DEFAULT NULL,
`timeline` varchar(255) NOT NULL,
`created_at` datetime(6) NOT NULL,
`updated_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_imported_posts_on_open_graph_id` (`open_graph_id`),
UNIQUE KEY `index_imported_posts_on_post_id` (`post_id`)
);
CREATE TABLE `invites` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`inviting_id` int(11) NOT NULL,
`timeline_id` int(11) NOT NULL,
`invited_id` int(11) NOT NULL,
`decision` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_invites_on_inviting_id_and_invited_id_and_timeline_id` (`inviting_id`,`invited_id`,`timeline_id`),
KEY `index_invites_on_invited_id` (`invited_id`)
);
CREATE TABLE `likes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_likes_on_post_id_and_user_id` (`post_id`,`user_id`),
KEY `index_likes_on_user_id` (`user_id`)
);
CREATE TABLE `mentions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`of_what` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`of_their_id` int(11) NOT NULL,
`in_what` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`in_their_id` int(11) NOT NULL,
`notified_at` datetime(6) DEFAULT NULL,
`ok_to_notify_version` int(11) DEFAULT NULL,
`notified_with` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime(6) NOT NULL,
`updated_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ndx_in_and_of` (`of_their_id`,`of_what`,`in_their_id`,`in_what`),
KEY `index_mentions_on_in_their_id_and_in_what` (`in_their_id`,`in_what`),
KEY `index_mentions_on_notified_at` (`notified_at`)
);
CREATE TABLE `notifications` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`transport` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`state` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`mention_id` int(11) NOT NULL,
`created_at` datetime(6) NOT NULL,
`sent_at` datetime(6) DEFAULT NULL,
`received_at` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `index_notifications_on_user_id_and_transport_and_state` (`user_id`,`transport`,`state`),
KEY `index_notifications_on_transport_and_state` (`transport`,`state`),
KEY `index_notifications_on_mention_id` (`mention_id`)
);
CREATE TABLE `open_graphs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`url` text COLLATE utf8_unicode_ci NOT NULL,
`title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`author` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`diagnostics` text COLLATE utf8_unicode_ci,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `index_open_graphs_on_user_id` (`user_id`)
);
CREATE TABLE `post_linebreaks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
);
CREATE TABLE `post_watermarks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`text_version` int(11) NOT NULL DEFAULT '1',
`likes_version` int(11) NOT NULL DEFAULT '1',
`faved` datetime(6) DEFAULT NULL,
`comments_version` int(11) NOT NULL DEFAULT '0',
`decisive_timelines` datetime(6) DEFAULT NULL,
`images` datetime(6) DEFAULT NULL,
`clikes` datetime(6) DEFAULT NULL,
`backlinks` datetime(6) DEFAULT NULL,
`subscription_timelines` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`published_at` datetime NOT NULL,
`text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`comments_disabled` tinyint(1) DEFAULT '0',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`fresh_at` datetime DEFAULT NULL,
`version` int(11) NOT NULL DEFAULT '0',
`frf_post_id` int(11) DEFAULT NULL,
`nsfw` tinyint(1) NOT NULL DEFAULT '0',
`comments_version` int(11) NOT NULL DEFAULT '0',
`language` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`realm` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `index_posts_on_frf_post_id` (`frf_post_id`),
KEY `index_posts_on_user_id` (`user_id`),
KEY `index_posts_on_updated_at` (`updated_at`),
KEY `index_posts_on_language_and_published_at` (`language`,`published_at`)
);
CREATE TABLE `reported_mentions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`mention_id` int(11) NOT NULL,
`what` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`extra_data` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`mentioned_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_reported_mentions_on_mention_id` (`mention_id`),
KEY `index_reported_mentions_on_user_id_and_mentioned_at` (`user_id`,`mentioned_at`)
);
CREATE TABLE `search_highlights` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`search_id` int(11) NOT NULL,
`post_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_search_highlights_on_search_id_and_post_id` (`search_id`,`post_id`),
KEY `index_search_highlights_on_post_id` (`post_id`)
);
CREATE TABLE `searches` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`q` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`last_searched_at` datetime(6) NOT NULL,
`refreshed_at` datetime(6) NOT NULL,
`created_at` datetime NOT NULL,
`uuid` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`finished` tinyint(1) DEFAULT '0',
`realm` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `index_searches_on_uuid` (`uuid`),
UNIQUE KEY `index_searches_on_q_and_realm` (`q`,`realm`),
KEY `index_searches_on_last_searched_at` (`last_searched_at`),
KEY `index_searches_on_refreshed_at` (`refreshed_at`)
);
CREATE TABLE `sharing_jsons` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`user_id` int(11) DEFAULT NULL,
`user_agent` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`json` text COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_sharing_jsons_on_uuid` (`uuid`),
KEY `index_sharing_jsons_on_user_id` (`user_id`)
);
CREATE TABLE `stage0_processed_images` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cluster_id` int(11) NOT NULL,
`schema_version` int(11) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ndx_szi_kind_cluster` (`id`,`cluster_id`)
);
CREATE TABLE `stage_one_images` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`stage_zero_image_id` int(11) NOT NULL,
`kind` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`cluster_id` int(11) NOT NULL,
`width` int(11) DEFAULT NULL,
`height` int(11) DEFAULT NULL,
`file_format` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`file_size` int(11) DEFAULT NULL,
`animated` tinyint(1) DEFAULT NULL,
`orientation` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_stage_one_images_on_uuid` (`uuid`),
UNIQUE KEY `szi_kind_file_format` (`stage_zero_image_id`,`kind`,`file_format`,`cluster_id`)
);
CREATE TABLE `stage_zero_images` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`user_id` int(11) NOT NULL,
`their_id` int(11) NOT NULL,
`what` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` datetime DEFAULT NULL,
`filename_from_upload` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`width` int(11) DEFAULT NULL,
`height` int(11) DEFAULT NULL,
`file_format` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`file_size` int(11) NOT NULL,
`animated` tinyint(1) DEFAULT NULL,
`exif_orientation` int(11) DEFAULT NULL,
`orientation` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`s3_uri` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime(6) NOT NULL,
`updated_at` datetime(6) NOT NULL,
`source_url` varchar(2048) COLLATE utf8_unicode_ci DEFAULT NULL,
`open_graph_id` int(11) DEFAULT NULL,
`sha256` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`position` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_stage_zero_images_on_uuid` (`uuid`),
KEY `index_stage_zero_images_on_their_id_and_what` (`their_id`,`what`),
KEY `index_stage_zero_images_on_deleted_at` (`deleted_at`),
KEY `index_stage_zero_images_on_s3_uri` (`s3_uri`),
KEY `index_stage_zero_images_on_user_id_and_what` (`user_id`,`what`)
);
CREATE TABLE `stats` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`metric` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`timestamp` datetime NOT NULL,
`value` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_stats_on_metric_and_timestamp` (`metric`,`timestamp`)
);
CREATE TABLE `sublist_timelines` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`subscription_list_id` int(11) NOT NULL,
`timeline_id` int(11) NOT NULL,
`created_at` datetime(6) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_sublist_timelines_on_subscription_list_id_and_timeline_id` (`subscription_list_id`,`timeline_id`),
KEY `index_sublist_timelines_on_timeline_id` (`timeline_id`),
KEY `index_sublist_timelines_on_user_id` (`user_id`)
);
CREATE TABLE `subscription_lists` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`homefeed` tinyint(1) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'homefeed',
PRIMARY KEY (`id`),
UNIQUE KEY `index_subscription_lists_on_user_id_and_slug` (`user_id`,`slug`)
);
CREATE TABLE `subscription_requests` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`what` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`their_id` int(11) NOT NULL,
`decision` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`decided_by_id` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`uuid` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`sublists` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'homefeed',
PRIMARY KEY (`id`),
UNIQUE KEY `index_subscription_requests_on_user_id_and_their_id_and_what` (`user_id`,`their_id`,`what`),
UNIQUE KEY `index_subscription_requests_on_uuid` (`uuid`),
KEY `index_subscription_requests_on_their_id` (`their_id`)
);
CREATE TABLE `subscriptions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`timeline_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_u_sl_t` (`user_id`,`timeline_id`),
KEY `index_subscriptions_on_timeline_id` (`timeline_id`)
);
CREATE TABLE `takeouts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`what` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`filesize` bigint(20) DEFAULT NULL,
`sha1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `index_takeouts_on_user_id_and_status` (`user_id`,`status`)
);
CREATE TABLE `tier_updates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`version` int(11) NOT NULL,
`created_at` datetime(6) NOT NULL,
`tier0_updated` datetime(6) DEFAULT NULL,
`tier1_updated` datetime(6) DEFAULT NULL,
`tier2_updated` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_tier_updates_on_post_id_and_version` (`post_id`,`version`)
);
CREATE TABLE `timeline_entries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created_at` datetime NOT NULL,
`timeline_id` int(11) NOT NULL,
`post_id` int(11) NOT NULL,
`fresh_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_timeline_entries_on_post_id_and_timeline_id` (`post_id`,`timeline_id`),
KEY `ndx_covering_fresh_at_v2` (`timeline_id`,`fresh_at`,`post_id`),
KEY `ndx_covering_created_at_v2` (`timeline_id`,`created_at`,`post_id`)
);
CREATE TABLE `timelines` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`their_id` int(11) NOT NULL,
`what` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_timelines_on_their_id_and_what` (`their_id`,`what`)
);
CREATE TABLE `user_avatars` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`avatar_json` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`)
);
CREATE TABLE `user_css_themes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`theme_name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `user_group_engagements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`posts_count` int(11) NOT NULL,
`last_posted_to` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_user_group_engagements_on_user_id_and_group_id` (`user_id`,`group_id`)
);
CREATE TABLE `user_hides_comments_of` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`of_user_id` int(11) NOT NULL,
`created_at` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_user_hides_comments_of_on_user_id_and_of_user_id` (`user_id`,`of_user_id`),
KEY `index_user_hides_comments_of_on_of_user_id` (`of_user_id`)
);
CREATE TABLE `user_languages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`lang` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `index_user_languages_on_user_id` (`user_id`),
KEY `index_user_languages_on_lang` (`lang`)
);
CREATE TABLE `user_no_emojis` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
);
CREATE TABLE `user_watermarks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`comments_count` int(11) DEFAULT NULL,
`likes_count` int(11) DEFAULT NULL,
`subscriptions` datetime(6) NOT NULL DEFAULT '2015-05-12 10:08:10.000000',
`subscribers` datetime(6) NOT NULL DEFAULT '2015-05-12 10:08:10.000000',
`hidden_posts` datetime(6) NOT NULL DEFAULT '2015-05-12 10:08:10.000000',
`hidden_users` datetime(6) NOT NULL DEFAULT '2015-05-12 10:08:10.000000',
`blocked` datetime(6) NOT NULL DEFAULT '2015-05-12 10:08:10.000000',
`primary_structure` datetime(6) DEFAULT NULL,
`favorite_groups` datetime DEFAULT NULL,
`purged_by_version` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`display_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`show_display_names` int(11) DEFAULT '1',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`encrypted_password` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`banned_media` varchar(255) COLLATE utf8_unicode_ci DEFAULT '',
`use_calendar_feed` tinyint(1) NOT NULL DEFAULT '0',
`private_subfeed_name` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`private_subfeed_display_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`is_admin` tinyint(1) NOT NULL DEFAULT '0',
`deleted_at` datetime DEFAULT NULL,
`hide_foaf` tinyint(1) NOT NULL DEFAULT '0',
`realm` int(11) NOT NULL DEFAULT '0',
`archive_status` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`clikes_mode` int(11) DEFAULT '0',
`avatar_szi_id` int(11) DEFAULT NULL,
`direct_messages_welcome` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `index_users_on_email` (`email`),
KEY `index_users_on_name` (`name`)
);
CREATE TABLE `watermarks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`what` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`last_processed` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_watermarks_on_what` (`what`)
);
CREATE TABLE `wiki_pages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`published_at` datetime NOT NULL,
`slug` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,
`slug_normalized` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,
`slug_sha1` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`preserve_newlines` tinyint(1) NOT NULL DEFAULT '0',
`language` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`folder_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_wiki_pages_on_slug_sha1_and_user_id` (`slug_sha1`,`user_id`),
KEY `index_wiki_pages_on_slug_normalized` (`slug_normalized`(200)),
KEY `index_wiki_pages_on_user_id_and_status_and_folder_name` (`user_id`,`status`,`folder_name`)
);