Created
July 31, 2025 21:04
-
-
Save pushcx/b7836b1ec2b848b97b93132326c972b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*M!999999\- enable the sandbox mode */ | |
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | |
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | |
/*!40101 SET NAMES utf8mb4 */; | |
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | |
/*!40103 SET TIME_ZONE='+00:00' */; | |
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | |
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | |
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | |
/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; | |
DROP TABLE IF EXISTS `action_mailbox_inbound_emails`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `action_mailbox_inbound_emails` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`status` int(11) NOT NULL DEFAULT 0, | |
`message_id` varchar(255) NOT NULL, | |
`message_checksum` varchar(255) NOT NULL, | |
`created_at` datetime(6) NOT NULL, | |
`updated_at` datetime(6) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_action_mailbox_inbound_emails_uniqueness` (`message_id`,`message_checksum`) | |
) ENGINE=InnoDB AUTO_INCREMENT=32238 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `active_storage_attachments`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `active_storage_attachments` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`name` varchar(255) NOT NULL, | |
`record_type` varchar(255) NOT NULL, | |
`record_id` bigint(20) NOT NULL, | |
`blob_id` bigint(20) NOT NULL, | |
`created_at` datetime(6) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_active_storage_attachments_uniqueness` (`record_type`,`record_id`,`name`,`blob_id`), | |
KEY `index_active_storage_attachments_on_blob_id` (`blob_id`), | |
CONSTRAINT `fk_rails_c3b3935057` FOREIGN KEY (`blob_id`) REFERENCES `active_storage_blobs` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=32238 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `active_storage_blobs`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `active_storage_blobs` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`key` varchar(255) NOT NULL, | |
`filename` varchar(255) NOT NULL, | |
`content_type` varchar(255) DEFAULT NULL, | |
`metadata` text DEFAULT NULL, | |
`service_name` varchar(255) NOT NULL, | |
`byte_size` bigint(20) NOT NULL, | |
`checksum` varchar(255) DEFAULT NULL, | |
`created_at` datetime(6) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_active_storage_blobs_on_key` (`key`) | |
) ENGINE=InnoDB AUTO_INCREMENT=32238 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `active_storage_variant_records`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `active_storage_variant_records` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`blob_id` bigint(20) NOT NULL, | |
`variation_digest` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_active_storage_variant_records_uniqueness` (`blob_id`,`variation_digest`), | |
CONSTRAINT `fk_rails_993965df05` FOREIGN KEY (`blob_id`) REFERENCES `active_storage_blobs` (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `ar_internal_metadata`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `ar_internal_metadata` ( | |
`key` varchar(255) NOT NULL, | |
`value` varchar(255) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`key`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `categories`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `categories` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`category` varchar(25) NOT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_categories_on_category` (`category`), | |
UNIQUE KEY `index_categories_on_token` (`token`) | |
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `comment_stats`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `comment_stats` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`date` date NOT NULL, | |
`average` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_comment_stats_on_date` (`date`) | |
) ENGINE=InnoDB AUTO_INCREMENT=4611 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `comments`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `comments` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime DEFAULT NULL, | |
`short_id` varchar(10) NOT NULL DEFAULT '', | |
`story_id` bigint(20) unsigned NOT NULL, | |
`confidence_order` binary(3) NOT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`parent_comment_id` bigint(20) unsigned DEFAULT NULL, | |
`thread_id` bigint(20) unsigned DEFAULT NULL, | |
`comment` mediumtext NOT NULL, | |
`score` int(11) NOT NULL DEFAULT 1, | |
`flags` int(10) unsigned NOT NULL DEFAULT 0, | |
`confidence` decimal(20,19) NOT NULL DEFAULT 0.0000000000000000000, | |
`markeddown_comment` mediumtext DEFAULT NULL, | |
`is_deleted` tinyint(1) NOT NULL DEFAULT 0, | |
`is_moderated` tinyint(1) NOT NULL DEFAULT 0, | |
`is_from_email` tinyint(1) NOT NULL DEFAULT 0, | |
`hat_id` bigint(20) unsigned DEFAULT NULL, | |
`depth` int(11) NOT NULL DEFAULT 0, | |
`reply_count` int(11) NOT NULL DEFAULT 0, | |
`last_reply_at` datetime(6) DEFAULT NULL, | |
`last_edited_at` datetime(6) NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `short_id` (`short_id`), | |
UNIQUE KEY `index_comments_on_token` (`token`), | |
KEY `thread_id` (`thread_id`), | |
KEY `story_id_short_id` (`story_id`,`short_id`), | |
KEY `confidence_idx` (`confidence`), | |
KEY `index_comments_on_user_id` (`user_id`), | |
KEY `comments_hat_id_fk` (`hat_id`), | |
KEY `comments_parent_comment_id_fk` (`parent_comment_id`), | |
KEY `index_comments_on_score` (`score`), | |
FULLTEXT KEY `index_comments_on_comment` (`comment`), | |
CONSTRAINT `comments_hat_id_fk` FOREIGN KEY (`hat_id`) REFERENCES `hats` (`id`), | |
CONSTRAINT `comments_parent_comment_id_fk` FOREIGN KEY (`parent_comment_id`) REFERENCES `comments` (`id`), | |
CONSTRAINT `comments_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `comments_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=596763 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `domains`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `domains` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`domain` varchar(255) NOT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
`banned_at` datetime DEFAULT NULL, | |
`banned_by_user_id` bigint(20) unsigned DEFAULT NULL, | |
`banned_reason` varchar(200) DEFAULT NULL, | |
`selector` varchar(255) DEFAULT NULL, | |
`replacement` varchar(255) DEFAULT NULL, | |
`stories_count` int(11) NOT NULL DEFAULT 0, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_domains_on_domain` (`domain`), | |
UNIQUE KEY `index_domains_on_token` (`token`), | |
KEY `index_domains_on_banned_by_user_id` (`banned_by_user_id`), | |
CONSTRAINT `fk_rails_c15837f026` FOREIGN KEY (`banned_by_user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=31806 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `hat_requests`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `hat_requests` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`created_at` datetime DEFAULT NULL, | |
`updated_at` datetime DEFAULT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`hat` varchar(255) NOT NULL, | |
`link` varchar(255) NOT NULL, | |
`comment` text NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_hat_requests_on_token` (`token`), | |
KEY `hat_requests_user_id_fk` (`user_id`), | |
CONSTRAINT `hat_requests_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=87 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `hats`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `hats` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`created_at` datetime DEFAULT NULL, | |
`updated_at` datetime DEFAULT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`granted_by_user_id` bigint(20) unsigned NOT NULL, | |
`hat` varchar(255) NOT NULL, | |
`link` varchar(255) DEFAULT NULL, | |
`modlog_use` tinyint(1) NOT NULL DEFAULT 0, | |
`doffed_at` datetime DEFAULT NULL, | |
`short_id` varchar(10) NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_hats_on_token` (`token`), | |
KEY `hats_granted_by_user_id_fk` (`granted_by_user_id`), | |
KEY `hats_user_id_fk` (`user_id`), | |
CONSTRAINT `hats_granted_by_user_id_fk` FOREIGN KEY (`granted_by_user_id`) REFERENCES `users` (`id`), | |
CONSTRAINT `hats_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=264 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `hidden_stories`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `hidden_stories` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`story_id` bigint(20) unsigned NOT NULL, | |
`created_at` datetime(6) DEFAULT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_hidden_stories_on_user_id_and_story_id` (`user_id`,`story_id`), | |
UNIQUE KEY `index_hidden_stories_on_token` (`token`), | |
KEY `hidden_stories_story_id_fk` (`story_id`), | |
CONSTRAINT `hidden_stories_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `hidden_stories_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=233154 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `invitation_requests`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `invitation_requests` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`code` varchar(255) DEFAULT NULL, | |
`is_verified` tinyint(1) NOT NULL DEFAULT 0, | |
`email` varchar(255) NOT NULL, | |
`name` varchar(255) NOT NULL, | |
`memo` tinytext DEFAULT NULL, | |
`ip_address` varchar(255) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_invitation_requests_on_token` (`token`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `invitations`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `invitations` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`email` varchar(255) DEFAULT NULL, | |
`code` varchar(255) DEFAULT NULL, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
`memo` text DEFAULT NULL, | |
`used_at` datetime DEFAULT NULL, | |
`new_user_id` bigint(20) unsigned DEFAULT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_invitations_on_token` (`token`), | |
KEY `invitations_new_user_id_fk` (`new_user_id`), | |
KEY `invitations_user_id_fk` (`user_id`), | |
CONSTRAINT `invitations_new_user_id_fk` FOREIGN KEY (`new_user_id`) REFERENCES `users` (`id`), | |
CONSTRAINT `invitations_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=11952 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `keystores`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `keystores` ( | |
`key` varchar(50) NOT NULL DEFAULT '', | |
`value` bigint(20) DEFAULT NULL, | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `key` (`key`) | |
) ENGINE=InnoDB AUTO_INCREMENT=3623015 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `links`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `links` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`url` varchar(250) NOT NULL, | |
`normalized_url` varchar(255) NOT NULL, | |
`title` varchar(255) DEFAULT NULL, | |
`from_story_id` bigint(20) unsigned DEFAULT NULL, | |
`from_comment_id` bigint(20) unsigned DEFAULT NULL, | |
`to_story_id` bigint(20) unsigned DEFAULT NULL, | |
`to_comment_id` bigint(20) unsigned DEFAULT NULL, | |
PRIMARY KEY (`id`), | |
KEY `index_links_on_normalized_url` (`normalized_url`), | |
KEY `index_links_on_from_story_id` (`from_story_id`), | |
KEY `index_links_on_from_comment_id` (`from_comment_id`), | |
KEY `index_links_on_to_story_id` (`to_story_id`), | |
KEY `index_links_on_to_comment_id` (`to_comment_id`), | |
CONSTRAINT `fk_rails_51de50cb3b` FOREIGN KEY (`from_comment_id`) REFERENCES `comments` (`id`), | |
CONSTRAINT `fk_rails_ac0932f49b` FOREIGN KEY (`to_comment_id`) REFERENCES `comments` (`id`), | |
CONSTRAINT `fk_rails_d7bbd2b475` FOREIGN KEY (`from_story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `fk_rails_f04e4c6073` FOREIGN KEY (`to_story_id`) REFERENCES `stories` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=256477 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `mastodon_apps`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `mastodon_apps` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`name` varchar(255) NOT NULL, | |
`client_id` varchar(255) NOT NULL, | |
`client_secret` varchar(255) NOT NULL, | |
`created_at` datetime(6) NOT NULL, | |
`updated_at` datetime(6) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_mastodon_apps_on_name` (`name`) | |
) ENGINE=InnoDB AUTO_INCREMENT=188 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `messages`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `messages` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`created_at` datetime DEFAULT NULL, | |
`author_user_id` bigint(20) unsigned DEFAULT NULL, | |
`recipient_user_id` bigint(20) unsigned NOT NULL, | |
`has_been_read` tinyint(1) NOT NULL DEFAULT 0, | |
`subject` varchar(100) DEFAULT NULL, | |
`body` mediumtext DEFAULT NULL, | |
`short_id` varchar(30) DEFAULT NULL, | |
`deleted_by_author` tinyint(1) NOT NULL DEFAULT 0, | |
`deleted_by_recipient` tinyint(1) NOT NULL DEFAULT 0, | |
`hat_id` bigint(20) unsigned DEFAULT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_messages_on_token` (`token`), | |
UNIQUE KEY `random_hash` (`short_id`), | |
KEY `index_messages_on_hat_id` (`hat_id`), | |
KEY `messages_recipient_user_id_fk` (`recipient_user_id`), | |
KEY `index_messages_on_author_user_id` (`author_user_id`), | |
CONSTRAINT `fk_rails_013215d0ae` FOREIGN KEY (`author_user_id`) REFERENCES `users` (`id`), | |
CONSTRAINT `messages_hat_id_fk` FOREIGN KEY (`hat_id`) REFERENCES `hats` (`id`), | |
CONSTRAINT `messages_recipient_user_id_fk` FOREIGN KEY (`recipient_user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=18705 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `mod_notes`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `mod_notes` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`moderator_user_id` bigint(20) unsigned NOT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`note` text NOT NULL, | |
`markeddown_note` text NOT NULL, | |
`created_at` datetime NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_mod_notes_on_token` (`token`), | |
KEY `index_mod_notes_on_id_and_user_id` (`id`,`user_id`), | |
KEY `mod_notes_moderator_user_id_fk` (`moderator_user_id`), | |
KEY `mod_notes_user_id_fk` (`user_id`), | |
CONSTRAINT `mod_notes_moderator_user_id_fk` FOREIGN KEY (`moderator_user_id`) REFERENCES `users` (`id`), | |
CONSTRAINT `mod_notes_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=8065 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `moderations`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `moderations` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
`moderator_user_id` bigint(20) unsigned DEFAULT NULL, | |
`story_id` bigint(20) unsigned DEFAULT NULL, | |
`comment_id` bigint(20) unsigned DEFAULT NULL, | |
`user_id` bigint(20) unsigned DEFAULT NULL, | |
`action` longtext NOT NULL, | |
`reason` mediumtext DEFAULT NULL, | |
`is_from_suggestions` tinyint(1) NOT NULL DEFAULT 0, | |
`tag_id` bigint(20) unsigned DEFAULT NULL, | |
`domain_id` bigint(20) DEFAULT NULL, | |
`category_id` bigint(20) DEFAULT NULL, | |
`origin_id` bigint(20) DEFAULT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_moderations_on_token` (`token`), | |
KEY `index_moderations_on_created_at` (`created_at`), | |
KEY `moderations_comment_id_fk` (`comment_id`), | |
KEY `moderations_moderator_user_id_fk` (`moderator_user_id`), | |
KEY `moderations_story_id_fk` (`story_id`), | |
KEY `moderations_tag_id_fk` (`tag_id`), | |
KEY `index_moderations_on_user_id` (`user_id`), | |
KEY `index_moderations_on_domain_id` (`domain_id`), | |
KEY `index_moderations_on_category_id` (`category_id`), | |
KEY `index_moderations_on_origin_id` (`origin_id`), | |
CONSTRAINT `fk_rails_a286a4afe4` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`), | |
CONSTRAINT `fk_rails_ac858bba09` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), | |
CONSTRAINT `fk_rails_b95b064e59` FOREIGN KEY (`domain_id`) REFERENCES `domains` (`id`), | |
CONSTRAINT `fk_rails_babb42ccfe` FOREIGN KEY (`origin_id`) REFERENCES `origins` (`id`), | |
CONSTRAINT `moderations_comment_id_fk` FOREIGN KEY (`comment_id`) REFERENCES `comments` (`id`), | |
CONSTRAINT `moderations_moderator_user_id_fk` FOREIGN KEY (`moderator_user_id`) REFERENCES `users` (`id`), | |
CONSTRAINT `moderations_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `moderations_tag_id_fk` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=12565 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `notifications`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `notifications` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`notifiable_type` varchar(255) NOT NULL, | |
`notifiable_id` bigint(20) unsigned NOT NULL, | |
`read_at` datetime(6) DEFAULT NULL, | |
`token` varchar(255) NOT NULL, | |
`created_at` datetime(6) NOT NULL, | |
`updated_at` datetime(6) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `idx_on_user_id_notifiable_type_notifiable_id_ffac34041e` (`user_id`,`notifiable_type`,`notifiable_id`), | |
UNIQUE KEY `index_notifications_on_token` (`token`), | |
KEY `index_notifications_on_notifiable` (`notifiable_type`,`notifiable_id`), | |
CONSTRAINT `fk_rails_b080fb4855` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=425918 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `origins`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `origins` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`domain_id` bigint(20) NOT NULL, | |
`identifier` varchar(255) NOT NULL, | |
`stories_count` int(11) NOT NULL DEFAULT 0, | |
`banned_at` datetime(6) DEFAULT NULL, | |
`banned_by_user_id` bigint(20) unsigned DEFAULT NULL, | |
`banned_reason` varchar(200) DEFAULT NULL, | |
`created_at` datetime(6) NOT NULL, | |
`updated_at` datetime(6) NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_origins_on_identifier` (`identifier`), | |
UNIQUE KEY `index_origins_on_token` (`token`), | |
KEY `index_origins_on_domain_id` (`domain_id`), | |
KEY `index_origins_on_banned_by_user_id` (`banned_by_user_id`), | |
CONSTRAINT `fk_rails_28194a0343` FOREIGN KEY (`domain_id`) REFERENCES `domains` (`id`), | |
CONSTRAINT `fk_rails_70b1f44aed` FOREIGN KEY (`banned_by_user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=7571 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `read_ribbons`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `read_ribbons` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`is_following` tinyint(1) NOT NULL DEFAULT 1, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`story_id` bigint(20) unsigned NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `index_read_ribbons_on_user_id` (`user_id`), | |
KEY `index_read_ribbons_on_story_id` (`story_id`), | |
CONSTRAINT `read_ribbons_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `read_ribbons_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=8197228 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `replying_comments`; | |
/*!50001 DROP VIEW IF EXISTS `replying_comments`*/; | |
SET @saved_cs_client = @@character_set_client; | |
SET character_set_client = utf8mb4; | |
/*!50001 CREATE VIEW `replying_comments` AS SELECT | |
1 AS `user_id`, | |
1 AS `comment_id`, | |
1 AS `story_id`, | |
1 AS `parent_comment_id`, | |
1 AS `comment_created_at`, | |
1 AS `parent_comment_author_id`, | |
1 AS `comment_author_id`, | |
1 AS `story_author_id`, | |
1 AS `is_unread`, | |
1 AS `current_vote_vote`, | |
1 AS `current_vote_reason` */; | |
SET character_set_client = @saved_cs_client; | |
DROP TABLE IF EXISTS `saved_stories`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `saved_stories` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`story_id` bigint(20) unsigned NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_saved_stories_on_user_id_and_story_id` (`user_id`,`story_id`), | |
UNIQUE KEY `index_saved_stories_on_token` (`token`), | |
KEY `saved_stories_story_id_fk` (`story_id`), | |
CONSTRAINT `saved_stories_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `saved_stories_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=197001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `schema_migrations`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `schema_migrations` ( | |
`version` varchar(255) NOT NULL, | |
PRIMARY KEY (`version`), | |
UNIQUE KEY `unique_schema_migrations` (`version`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `stories`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `stories` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`created_at` datetime DEFAULT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`url` varchar(250) DEFAULT '', | |
`normalized_url` varchar(255) DEFAULT NULL, | |
`title` varchar(150) NOT NULL DEFAULT '', | |
`description` text DEFAULT NULL, | |
`short_id` char(6) NOT NULL DEFAULT '', | |
`is_deleted` tinyint(1) NOT NULL DEFAULT 0, | |
`score` int(11) NOT NULL DEFAULT 1, | |
`flags` int(10) unsigned NOT NULL DEFAULT 0, | |
`is_moderated` tinyint(1) NOT NULL DEFAULT 0, | |
`hotness` decimal(20,10) NOT NULL DEFAULT 0.0000000000, | |
`markeddown_description` mediumtext DEFAULT NULL, | |
`comments_count` int(11) NOT NULL DEFAULT 0, | |
`merged_story_id` bigint(20) unsigned DEFAULT NULL, | |
`unavailable_at` datetime DEFAULT NULL, | |
`twitter_id` varchar(20) DEFAULT NULL, | |
`user_is_author` tinyint(1) NOT NULL DEFAULT 0, | |
`user_is_following` tinyint(1) NOT NULL DEFAULT 0, | |
`domain_id` bigint(20) DEFAULT NULL, | |
`mastodon_id` varchar(25) DEFAULT NULL, | |
`origin_id` bigint(20) DEFAULT NULL, | |
`last_comment_at` datetime(6) DEFAULT NULL, | |
`stories_count` int(11) NOT NULL DEFAULT 0, | |
`updated_at` datetime(6) NOT NULL, | |
`last_edited_at` datetime(6) NOT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `unique_short_id` (`short_id`), | |
UNIQUE KEY `index_stories_on_token` (`token`), | |
KEY `url` (`url`(191)), | |
KEY `hotness_idx` (`hotness`), | |
KEY `index_stories_on_merged_story_id` (`merged_story_id`), | |
KEY `index_stories_on_created_at` (`created_at`), | |
KEY `index_stories_on_user_id` (`user_id`), | |
KEY `index_stories_on_domain_id` (`domain_id`), | |
KEY `index_stories_on_score` (`score`), | |
KEY `index_stories_on_id_and_is_deleted` (`id`,`is_deleted`), | |
KEY `index_stories_on_normalized_url` (`normalized_url`), | |
KEY `index_stories_on_mastodon_id` (`mastodon_id`), | |
KEY `index_stories_on_origin_id` (`origin_id`), | |
KEY `index_stories_on_last_comment_at` (`last_comment_at`), | |
CONSTRAINT `fk_rails_a04bca56b0` FOREIGN KEY (`domain_id`) REFERENCES `domains` (`id`), | |
CONSTRAINT `fk_rails_de71845285` FOREIGN KEY (`origin_id`) REFERENCES `origins` (`id`), | |
CONSTRAINT `stories_merged_story_id_fk` FOREIGN KEY (`merged_story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `stories_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=116474 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `story_texts`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `story_texts` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`title` varchar(150) NOT NULL DEFAULT '', | |
`description` mediumtext DEFAULT NULL, | |
`body` mediumtext DEFAULT NULL, | |
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), | |
PRIMARY KEY (`id`), | |
FULLTEXT KEY `index_story_texts_on_title_and_description_and_body` (`title`,`description`,`body`), | |
FULLTEXT KEY `index_story_texts_on_title` (`title`) | |
) ENGINE=InnoDB AUTO_INCREMENT=116474 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `suggested_taggings`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `suggested_taggings` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`story_id` bigint(20) unsigned NOT NULL, | |
`tag_id` bigint(20) unsigned NOT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `suggested_taggings_story_id_fk` (`story_id`), | |
KEY `suggested_taggings_tag_id_fk` (`tag_id`), | |
KEY `suggested_taggings_user_id_fk` (`user_id`), | |
CONSTRAINT `suggested_taggings_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `suggested_taggings_tag_id_fk` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`), | |
CONSTRAINT `suggested_taggings_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=25367 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `suggested_titles`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `suggested_titles` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`story_id` bigint(20) unsigned NOT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`title` varchar(150) NOT NULL DEFAULT '', | |
PRIMARY KEY (`id`), | |
KEY `suggested_titles_story_id_fk` (`story_id`), | |
KEY `suggested_titles_user_id_fk` (`user_id`), | |
CONSTRAINT `suggested_titles_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `suggested_titles_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=5283 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `tag_filters`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `tag_filters` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`created_at` datetime NOT NULL, | |
`updated_at` datetime NOT NULL, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`tag_id` bigint(20) unsigned NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `user_tag_idx` (`user_id`,`tag_id`), | |
KEY `tag_filters_tag_id_fk` (`tag_id`), | |
CONSTRAINT `tag_filters_tag_id_fk` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`), | |
CONSTRAINT `tag_filters_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=25307 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `taggings`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `taggings` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`story_id` bigint(20) unsigned NOT NULL, | |
`tag_id` bigint(20) unsigned NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `story_id_tag_id` (`story_id`,`tag_id`), | |
KEY `taggings_tag_id_fk` (`tag_id`), | |
CONSTRAINT `taggings_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `taggings_tag_id_fk` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE ON UPDATE CASCADE | |
) ENGINE=InnoDB AUTO_INCREMENT=211229 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `tags`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `tags` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`tag` varchar(25) NOT NULL, | |
`description` varchar(100) DEFAULT NULL, | |
`privileged` tinyint(1) NOT NULL DEFAULT 0, | |
`is_media` tinyint(1) NOT NULL DEFAULT 0, | |
`active` tinyint(1) NOT NULL DEFAULT 1, | |
`hotness_mod` float DEFAULT 0, | |
`permit_by_new_users` tinyint(1) NOT NULL DEFAULT 1, | |
`category_id` bigint(20) NOT NULL, | |
`token` varchar(255) NOT NULL, | |
`created_at` datetime(6) NOT NULL, | |
`updated_at` datetime(6) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `tag` (`tag`), | |
UNIQUE KEY `index_tags_on_token` (`token`), | |
KEY `index_tags_on_category_id` (`category_id`), | |
CONSTRAINT `fk_rails_96a8141007` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `users`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `users` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`username` varchar(50) DEFAULT NULL, | |
`email` varchar(100) DEFAULT NULL, | |
`password_digest` varchar(75) DEFAULT NULL, | |
`created_at` datetime DEFAULT NULL, | |
`is_admin` tinyint(1) NOT NULL DEFAULT 0, | |
`password_reset_token` varchar(75) DEFAULT NULL, | |
`session_token` varchar(75) NOT NULL DEFAULT '', | |
`about` mediumtext DEFAULT NULL, | |
`invited_by_user_id` bigint(20) unsigned DEFAULT NULL, | |
`is_moderator` tinyint(1) NOT NULL DEFAULT 0, | |
`pushover_mentions` tinyint(1) NOT NULL DEFAULT 0, | |
`rss_token` varchar(75) DEFAULT NULL, | |
`mailing_list_token` varchar(75) DEFAULT NULL, | |
`mailing_list_mode` int(11) DEFAULT 0, | |
`karma` int(11) NOT NULL DEFAULT 0, | |
`banned_at` datetime DEFAULT NULL, | |
`banned_by_user_id` bigint(20) unsigned DEFAULT NULL, | |
`banned_reason` varchar(256) DEFAULT NULL, | |
`deleted_at` datetime DEFAULT NULL, | |
`disabled_invite_at` datetime DEFAULT NULL, | |
`disabled_invite_by_user_id` bigint(20) unsigned DEFAULT NULL, | |
`disabled_invite_reason` varchar(200) DEFAULT NULL, | |
`settings` mediumtext DEFAULT NULL, | |
`show_email` tinyint(1) NOT NULL DEFAULT 0, | |
`last_read_newest_story` datetime(6) DEFAULT NULL, | |
`last_read_newest_comment` datetime(6) DEFAULT NULL, | |
`token` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `session_hash` (`session_token`), | |
UNIQUE KEY `index_users_on_token` (`token`), | |
UNIQUE KEY `username` (`username`), | |
UNIQUE KEY `password_reset_token` (`password_reset_token`), | |
UNIQUE KEY `rss_token` (`rss_token`), | |
UNIQUE KEY `mailing_list_token` (`mailing_list_token`), | |
UNIQUE KEY `index_users_on_email` (`email`), | |
KEY `mailing_list_enabled` (`mailing_list_mode`), | |
KEY `users_banned_by_user_id_fk` (`banned_by_user_id`), | |
KEY `users_disabled_invite_by_user_id_fk` (`disabled_invite_by_user_id`), | |
KEY `users_invited_by_user_id_fk` (`invited_by_user_id`), | |
CONSTRAINT `users_banned_by_user_id_fk` FOREIGN KEY (`banned_by_user_id`) REFERENCES `users` (`id`), | |
CONSTRAINT `users_disabled_invite_by_user_id_fk` FOREIGN KEY (`disabled_invite_by_user_id`) REFERENCES `users` (`id`), | |
CONSTRAINT `users_invited_by_user_id_fk` FOREIGN KEY (`invited_by_user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=18729 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
DROP TABLE IF EXISTS `votes`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8mb4 */; | |
CREATE TABLE `votes` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`user_id` bigint(20) unsigned NOT NULL, | |
`story_id` bigint(20) unsigned NOT NULL, | |
`comment_id` bigint(20) unsigned DEFAULT NULL, | |
`vote` tinyint(4) NOT NULL, | |
`reason` varchar(1) NOT NULL DEFAULT '', | |
`updated_at` datetime NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `user_id_comment_id` (`user_id`,`comment_id`), | |
KEY `user_id_story_id` (`user_id`,`story_id`), | |
KEY `index_votes_on_comment_id` (`comment_id`), | |
KEY `votes_story_id_fk` (`story_id`), | |
CONSTRAINT `votes_comment_id_fk` FOREIGN KEY (`comment_id`) REFERENCES `comments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, | |
CONSTRAINT `votes_story_id_fk` FOREIGN KEY (`story_id`) REFERENCES `stories` (`id`), | |
CONSTRAINT `votes_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=4091064 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
/*!50001 DROP VIEW IF EXISTS `replying_comments`*/; | |
/*!50001 SET @saved_cs_client = @@character_set_client */; | |
/*!50001 SET @saved_cs_results = @@character_set_results */; | |
/*!50001 SET @saved_col_connection = @@collation_connection */; | |
/*!50001 SET character_set_client = utf8mb4 */; | |
/*!50001 SET character_set_results = utf8mb4 */; | |
/*!50001 SET collation_connection = utf8mb4_uca1400_ai_ci */; | |
/*!50001 CREATE ALGORITHM=UNDEFINED */ | |
/*!50013 DEFINER=`pushcx`@`localhost` SQL SECURITY DEFINER */ | |
/*!50001 VIEW `replying_comments` AS select `read_ribbons`.`user_id` AS `user_id`,`comments`.`id` AS `comment_id`,`read_ribbons`.`story_id` AS `story_id`,`comments`.`parent_comment_id` AS `parent_comment_id`,`comments`.`created_at` AS `comment_created_at`,`parent_comments`.`user_id` AS `parent_comment_author_id`,`comments`.`user_id` AS `comment_author_id`,`stories`.`user_id` AS `story_author_id`,`read_ribbons`.`updated_at` < `comments`.`created_at` AS `is_unread`,(select `votes`.`vote` from `votes` where `votes`.`user_id` = `read_ribbons`.`user_id` and `votes`.`comment_id` = `comments`.`id`) AS `current_vote_vote`,(select `votes`.`reason` from `votes` where `votes`.`user_id` = `read_ribbons`.`user_id` and `votes`.`comment_id` = `comments`.`id`) AS `current_vote_reason` from (((`read_ribbons` join `comments` on(`comments`.`story_id` = `read_ribbons`.`story_id`)) join `stories` on(`stories`.`id` = `comments`.`story_id`)) left join `comments` `parent_comments` on(`parent_comments`.`id` = `comments`.`parent_comment_id`)) where `read_ribbons`.`is_following` = 1 and `comments`.`user_id` <> `read_ribbons`.`user_id` and `comments`.`is_deleted` = 0 and `comments`.`is_moderated` = 0 and (`parent_comments`.`user_id` = `read_ribbons`.`user_id` or `parent_comments`.`user_id` is null and `stories`.`user_id` = `read_ribbons`.`user_id`) and `stories`.`score` > `stories`.`flags` and `comments`.`score` > `comments`.`flags` and (`parent_comments`.`id` is null or `parent_comments`.`score` > `parent_comments`.`flags` and `parent_comments`.`is_moderated` = 0 and `parent_comments`.`is_deleted` = 0) and !exists(select 1 from (`votes` `f` join `comments` `c` on(`f`.`comment_id` = `c`.`id`)) where `f`.`vote` < 0 and `f`.`user_id` = `parent_comments`.`user_id` and `c`.`user_id` = `comments`.`user_id` and `f`.`story_id` = `comments`.`story_id` limit 1) and !exists(select 1 from `hidden_stories` `h` where `h`.`story_id` = `stories`.`id` and `h`.`user_id` = `parent_comments`.`user_id` limit 1) */; | |
/*!50001 SET character_set_client = @saved_cs_client */; | |
/*!50001 SET character_set_results = @saved_cs_results */; | |
/*!50001 SET collation_connection = @saved_col_connection */; | |
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | |
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | |
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | |
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | |
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | |
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | |
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | |
/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment