--
-- Host: localhost    Database: tannei
-- ------------------------------------------------------


--
-- Current Database: `tannei`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `tannei` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;

USE `tannei`;

--
-- Table structure for table `tanneidiscussion_tag`
--

CREATE TABLE `tanneidiscussion_tag` (
  `discussion_id` int unsigned NOT NULL,
  `tag_id` int unsigned NOT NULL,
  PRIMARY KEY (`discussion_id`,`tag_id`),
  KEY `tanneidiscussion_tag_tag_id_foreign` (`tag_id`),
  CONSTRAINT `tanneidiscussion_tag_discussion_id_foreign` FOREIGN KEY (`discussion_id`) REFERENCES `tanneidiscussions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneidiscussion_tag_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `tanneitags` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneidiscussion_tag`
--

INSERT INTO `tanneidiscussion_tag` VALUES (2,1),(3,1),(4,1),(5,1);

--
-- Table structure for table `tanneidiscussion_user`
--

CREATE TABLE `tanneidiscussion_user` (
  `user_id` int unsigned NOT NULL,
  `discussion_id` int unsigned NOT NULL,
  `last_read_at` datetime DEFAULT NULL,
  `last_read_post_number` int unsigned DEFAULT NULL,
  `subscription` enum('follow','ignore') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`user_id`,`discussion_id`),
  KEY `tanneidiscussion_user_discussion_id_foreign` (`discussion_id`),
  CONSTRAINT `tanneidiscussion_user_discussion_id_foreign` FOREIGN KEY (`discussion_id`) REFERENCES `tanneidiscussions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneidiscussion_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneidiscussion_user`
--

INSERT INTO `tanneidiscussion_user` VALUES (1,2,'2022-05-18 14:50:49',1,NULL),(1,3,'2022-05-18 23:17:09',1,NULL),(1,4,'2022-05-19 00:21:45',1,NULL),(1,5,'2022-05-20 12:52:33',1,NULL);

--
-- Table structure for table `tanneidiscussions`
--

CREATE TABLE `tanneidiscussions` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `comment_count` int NOT NULL DEFAULT '1',
  `participant_count` int unsigned NOT NULL DEFAULT '0',
  `post_number_index` int unsigned NOT NULL DEFAULT '0',
  `created_at` datetime NOT NULL,
  `user_id` int unsigned DEFAULT NULL,
  `first_post_id` int unsigned DEFAULT NULL,
  `last_posted_at` datetime DEFAULT NULL,
  `last_posted_user_id` int unsigned DEFAULT NULL,
  `last_post_id` int unsigned DEFAULT NULL,
  `last_post_number` int unsigned DEFAULT NULL,
  `hidden_at` datetime DEFAULT NULL,
  `hidden_user_id` int unsigned DEFAULT NULL,
  `slug` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_private` tinyint(1) NOT NULL DEFAULT '0',
  `is_approved` tinyint(1) NOT NULL DEFAULT '1',
  `is_locked` tinyint(1) NOT NULL DEFAULT '0',
  `is_sticky` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `tanneidiscussions_hidden_user_id_foreign` (`hidden_user_id`),
  KEY `tanneidiscussions_first_post_id_foreign` (`first_post_id`),
  KEY `tanneidiscussions_last_post_id_foreign` (`last_post_id`),
  KEY `tanneidiscussions_last_posted_at_index` (`last_posted_at`),
  KEY `tanneidiscussions_last_posted_user_id_index` (`last_posted_user_id`),
  KEY `tanneidiscussions_created_at_index` (`created_at`),
  KEY `tanneidiscussions_user_id_index` (`user_id`),
  KEY `tanneidiscussions_comment_count_index` (`comment_count`),
  KEY `tanneidiscussions_participant_count_index` (`participant_count`),
  KEY `tanneidiscussions_hidden_at_index` (`hidden_at`),
  KEY `tanneidiscussions_is_locked_index` (`is_locked`),
  KEY `tanneidiscussions_is_sticky_created_at_index` (`is_sticky`,`created_at`),
  KEY `tanneidiscussions_is_sticky_last_posted_at_index` (`is_sticky`,`last_posted_at`),
  FULLTEXT KEY `title` (`title`),
  CONSTRAINT `tanneidiscussions_first_post_id_foreign` FOREIGN KEY (`first_post_id`) REFERENCES `tanneiposts` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneidiscussions_hidden_user_id_foreign` FOREIGN KEY (`hidden_user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneidiscussions_last_post_id_foreign` FOREIGN KEY (`last_post_id`) REFERENCES `tanneiposts` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneidiscussions_last_posted_user_id_foreign` FOREIGN KEY (`last_posted_user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneidiscussions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneidiscussions`
--

INSERT INTO `tanneidiscussions` VALUES (2,'测试中文',1,1,0,'2022-05-18 14:50:48',1,2,'2022-05-18 14:50:48',1,2,1,'2022-05-19 00:21:15',1,'',0,1,0,0),(3,'天气不错',1,1,0,'2022-05-18 23:17:09',1,3,'2022-05-18 23:17:09',1,3,1,NULL,NULL,'tian-qi-bu-cuo',0,1,0,0),(4,'最近好多裁员的 什么时候会好点啊',1,1,0,'2022-05-19 00:21:45',1,4,'2022-05-19 00:21:45',1,4,1,NULL,NULL,'zui-jin-hao-duo-cai-yuan-de-shi-yao-shi-hou-hui-hao-dian-a',0,1,0,0),(5,'已经居家办公一周了 ',1,1,0,'2022-05-20 12:52:32',1,5,'2022-05-20 12:52:32',1,5,1,NULL,NULL,'yi-jing-ju-jia-ban-gong-yi-zhou-liao',0,1,0,0);

--
-- Table structure for table `tanneiflags`
--

CREATE TABLE `tanneiflags` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `post_id` int unsigned NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int unsigned DEFAULT NULL,
  `reason` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reason_detail` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `tanneiflags_post_id_foreign` (`post_id`),
  KEY `tanneiflags_user_id_foreign` (`user_id`),
  KEY `tanneiflags_created_at_index` (`created_at`),
  CONSTRAINT `tanneiflags_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `tanneiposts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneiflags_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneiflags`
--


--
-- Table structure for table `tanneigroup_permission`
--

CREATE TABLE `tanneigroup_permission` (
  `group_id` int unsigned NOT NULL,
  `permission` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`group_id`,`permission`),
  CONSTRAINT `tanneigroup_permission_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `tanneigroups` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneigroup_permission`
--

INSERT INTO `tanneigroup_permission` VALUES (2,'viewForum'),(3,'discussion.flagPosts'),(3,'discussion.likePosts'),(3,'discussion.reply'),(3,'discussion.replyWithoutApproval'),(3,'discussion.startWithoutApproval'),(3,'searchUsers'),(3,'startDiscussion'),(4,'discussion.approvePosts'),(4,'discussion.editPosts'),(4,'discussion.hide'),(4,'discussion.hidePosts'),(4,'discussion.lock'),(4,'discussion.rename'),(4,'discussion.sticky'),(4,'discussion.tag'),(4,'discussion.viewFlags'),(4,'discussion.viewIpsPosts'),(4,'user.suspend'),(4,'user.viewLastSeenAt');

--
-- Table structure for table `tanneigroup_user`
--

CREATE TABLE `tanneigroup_user` (
  `user_id` int unsigned NOT NULL,
  `group_id` int unsigned NOT NULL,
  PRIMARY KEY (`user_id`,`group_id`),
  KEY `tanneigroup_user_group_id_foreign` (`group_id`),
  CONSTRAINT `tanneigroup_user_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `tanneigroups` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneigroup_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneigroup_user`
--

INSERT INTO `tanneigroup_user` VALUES (1,1);

--
-- Table structure for table `tanneigroups`
--

CREATE TABLE `tanneigroups` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `name_singular` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_plural` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_hidden` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneigroups`
--

INSERT INTO `tanneigroups` VALUES (1,'Admin','Admins','#B72A2A','fas fa-wrench',0),(2,'Guest','Guests',NULL,NULL,0),(3,'Member','Members',NULL,NULL,0),(4,'Mod','Mods','#80349E','fas fa-bolt',0);

--
-- Table structure for table `tanneilogin_providers`
--

CREATE TABLE `tanneilogin_providers` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `provider` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `identifier` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `last_login_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `tanneilogin_providers_provider_identifier_unique` (`provider`,`identifier`),
  KEY `tanneilogin_providers_user_id_foreign` (`user_id`),
  CONSTRAINT `tanneilogin_providers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneilogin_providers`
--


--
-- Table structure for table `tanneimigrations`
--

CREATE TABLE `tanneimigrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `extension` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneimigrations`
--

INSERT INTO `tanneimigrations` VALUES (1,'2015_02_24_000000_create_access_tokens_table',NULL),(2,'2015_02_24_000000_create_api_keys_table',NULL),(3,'2015_02_24_000000_create_config_table',NULL),(4,'2015_02_24_000000_create_discussions_table',NULL),(5,'2015_02_24_000000_create_email_tokens_table',NULL),(6,'2015_02_24_000000_create_groups_table',NULL),(7,'2015_02_24_000000_create_notifications_table',NULL),(8,'2015_02_24_000000_create_password_tokens_table',NULL),(9,'2015_02_24_000000_create_permissions_table',NULL),(10,'2015_02_24_000000_create_posts_table',NULL),(11,'2015_02_24_000000_create_users_discussions_table',NULL),(12,'2015_02_24_000000_create_users_groups_table',NULL),(13,'2015_02_24_000000_create_users_table',NULL),(14,'2015_09_15_000000_create_auth_tokens_table',NULL),(15,'2015_09_20_224327_add_hide_to_discussions',NULL),(16,'2015_09_22_030432_rename_notification_read_time',NULL),(17,'2015_10_07_130531_rename_config_to_settings',NULL),(18,'2015_10_24_194000_add_ip_address_to_posts',NULL),(19,'2015_12_05_042721_change_access_tokens_columns',NULL),(20,'2015_12_17_194247_change_settings_value_column_to_text',NULL),(21,'2016_02_04_095452_add_slug_to_discussions',NULL),(22,'2017_04_07_114138_add_is_private_to_discussions',NULL),(23,'2017_04_07_114138_add_is_private_to_posts',NULL),(24,'2018_01_11_093900_change_access_tokens_columns',NULL),(25,'2018_01_11_094000_change_access_tokens_add_foreign_keys',NULL),(26,'2018_01_11_095000_change_api_keys_columns',NULL),(27,'2018_01_11_101800_rename_auth_tokens_to_registration_tokens',NULL),(28,'2018_01_11_102000_change_registration_tokens_rename_id_to_token',NULL),(29,'2018_01_11_102100_change_registration_tokens_created_at_to_datetime',NULL),(30,'2018_01_11_120604_change_posts_table_to_innodb',NULL),(31,'2018_01_11_155200_change_discussions_rename_columns',NULL),(32,'2018_01_11_155300_change_discussions_add_foreign_keys',NULL),(33,'2018_01_15_071700_rename_users_discussions_to_discussion_user',NULL),(34,'2018_01_15_071800_change_discussion_user_rename_columns',NULL),(35,'2018_01_15_071900_change_discussion_user_add_foreign_keys',NULL),(36,'2018_01_15_072600_change_email_tokens_rename_id_to_token',NULL),(37,'2018_01_15_072700_change_email_tokens_add_foreign_keys',NULL),(38,'2018_01_15_072800_change_email_tokens_created_at_to_datetime',NULL),(39,'2018_01_18_130400_rename_permissions_to_group_permission',NULL),(40,'2018_01_18_130500_change_group_permission_add_foreign_keys',NULL),(41,'2018_01_18_130600_rename_users_groups_to_group_user',NULL),(42,'2018_01_18_130700_change_group_user_add_foreign_keys',NULL),(43,'2018_01_18_133000_change_notifications_columns',NULL),(44,'2018_01_18_133100_change_notifications_add_foreign_keys',NULL),(45,'2018_01_18_134400_change_password_tokens_rename_id_to_token',NULL),(46,'2018_01_18_134500_change_password_tokens_add_foreign_keys',NULL),(47,'2018_01_18_134600_change_password_tokens_created_at_to_datetime',NULL),(48,'2018_01_18_135000_change_posts_rename_columns',NULL),(49,'2018_01_18_135100_change_posts_add_foreign_keys',NULL),(50,'2018_01_30_112238_add_fulltext_index_to_discussions_title',NULL),(51,'2018_01_30_220100_create_post_user_table',NULL),(52,'2018_01_30_222900_change_users_rename_columns',NULL),(55,'2018_09_15_041340_add_users_indicies',NULL),(56,'2018_09_15_041828_add_discussions_indicies',NULL),(57,'2018_09_15_043337_add_notifications_indices',NULL),(58,'2018_09_15_043621_add_posts_indices',NULL),(59,'2018_09_22_004100_change_registration_tokens_columns',NULL),(60,'2018_09_22_004200_create_login_providers_table',NULL),(61,'2018_10_08_144700_add_shim_prefix_to_group_icons',NULL),(62,'2019_10_12_195349_change_posts_add_discussion_foreign_key',NULL),(63,'2020_03_19_134512_change_discussions_default_comment_count',NULL),(64,'2020_04_21_130500_change_permission_groups_add_is_hidden',NULL),(65,'2021_03_02_040000_change_access_tokens_add_type',NULL),(66,'2021_03_02_040500_change_access_tokens_add_id',NULL),(67,'2021_03_02_041000_change_access_tokens_add_title_ip_agent',NULL),(68,'2021_04_18_040500_change_migrations_add_id_primary_key',NULL),(69,'2021_04_18_145100_change_posts_content_column_to_mediumtext',NULL),(70,'2018_07_21_000000_seed_default_groups',NULL),(71,'2018_07_21_000100_seed_default_group_permissions',NULL),(72,'2021_05_10_000000_rename_permissions',NULL),(73,'2015_09_21_011527_add_is_approved_to_discussions','flarum-approval'),(74,'2015_09_21_011706_add_is_approved_to_posts','flarum-approval'),(75,'2017_07_22_000000_add_default_permissions','flarum-approval'),(76,'2018_09_29_060444_replace_emoji_shorcuts_with_unicode','flarum-emoji'),(77,'2015_09_02_000000_add_flags_read_time_to_users_table','flarum-flags'),(78,'2015_09_02_000000_create_flags_table','flarum-flags'),(79,'2017_07_22_000000_add_default_permissions','flarum-flags'),(80,'2018_06_27_101500_change_flags_rename_time_to_created_at','flarum-flags'),(81,'2018_06_27_101600_change_flags_add_foreign_keys','flarum-flags'),(82,'2018_06_27_105100_change_users_rename_flags_read_time_to_read_flags_at','flarum-flags'),(83,'2018_09_15_043621_add_flags_indices','flarum-flags'),(84,'2019_10_22_000000_change_reason_text_col_type','flarum-flags'),(85,'2015_05_11_000000_create_posts_likes_table','flarum-likes'),(86,'2015_09_04_000000_add_default_like_permissions','flarum-likes'),(87,'2018_06_27_100600_rename_posts_likes_to_post_likes','flarum-likes'),(88,'2018_06_27_100700_change_post_likes_add_foreign_keys','flarum-likes'),(89,'2021_05_10_094200_add_created_at_to_post_likes_table','flarum-likes'),(90,'2015_02_24_000000_add_locked_to_discussions','flarum-lock'),(91,'2017_07_22_000000_add_default_permissions','flarum-lock'),(92,'2018_09_15_043621_add_discussions_indices','flarum-lock'),(93,'2021_03_25_000000_default_settings','flarum-markdown'),(94,'2015_05_11_000000_create_mentions_posts_table','flarum-mentions'),(95,'2015_05_11_000000_create_mentions_users_table','flarum-mentions'),(96,'2018_06_27_102000_rename_mentions_posts_to_post_mentions_post','flarum-mentions'),(97,'2018_06_27_102100_rename_mentions_users_to_post_mentions_user','flarum-mentions'),(98,'2018_06_27_102200_change_post_mentions_post_rename_mentions_id_to_mentions_post_id','flarum-mentions'),(99,'2018_06_27_102300_change_post_mentions_post_add_foreign_keys','flarum-mentions'),(100,'2018_06_27_102400_change_post_mentions_user_rename_mentions_id_to_mentions_user_id','flarum-mentions'),(101,'2018_06_27_102500_change_post_mentions_user_add_foreign_keys','flarum-mentions'),(102,'2021_04_19_000000_set_default_settings','flarum-mentions'),(103,'2015_02_24_000000_add_sticky_to_discussions','flarum-sticky'),(104,'2017_07_22_000000_add_default_permissions','flarum-sticky'),(105,'2018_09_15_043621_add_discussions_indices','flarum-sticky'),(106,'2021_01_13_000000_add_discussion_last_posted_at_indices','flarum-sticky'),(107,'2015_05_11_000000_add_subscription_to_users_discussions_table','flarum-subscriptions'),(108,'2015_05_11_000000_add_suspended_until_to_users_table','flarum-suspend'),(109,'2015_09_14_000000_rename_suspended_until_column','flarum-suspend'),(110,'2017_07_22_000000_add_default_permissions','flarum-suspend'),(111,'2018_06_27_111400_change_users_rename_suspend_until_to_suspended_until','flarum-suspend'),(112,'2021_10_27_000000_add_suspend_reason_and_message','flarum-suspend'),(113,'2015_02_24_000000_create_discussions_tags_table','flarum-tags'),(114,'2015_02_24_000000_create_tags_table','flarum-tags'),(115,'2015_02_24_000000_create_users_tags_table','flarum-tags'),(116,'2015_02_24_000000_set_default_settings','flarum-tags'),(117,'2015_10_19_061223_make_slug_unique','flarum-tags'),(118,'2017_07_22_000000_add_default_permissions','flarum-tags'),(119,'2018_06_27_085200_change_tags_columns','flarum-tags'),(120,'2018_06_27_085300_change_tags_add_foreign_keys','flarum-tags'),(121,'2018_06_27_090400_rename_users_tags_to_tag_user','flarum-tags'),(122,'2018_06_27_100100_change_tag_user_rename_read_time_to_marked_as_read_at','flarum-tags'),(123,'2018_06_27_100200_change_tag_user_add_foreign_keys','flarum-tags'),(124,'2018_06_27_103000_rename_discussions_tags_to_discussion_tag','flarum-tags'),(125,'2018_06_27_103100_add_discussion_tag_foreign_keys','flarum-tags'),(126,'2019_04_21_000000_add_icon_to_tags_table','flarum-tags');

--
-- Table structure for table `tanneinotifications`
--

CREATE TABLE `tanneinotifications` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `from_user_id` int unsigned DEFAULT NULL,
  `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject_id` int unsigned DEFAULT NULL,
  `data` blob,
  `created_at` datetime NOT NULL,
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  `read_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `tanneinotifications_from_user_id_foreign` (`from_user_id`),
  KEY `tanneinotifications_user_id_index` (`user_id`),
  CONSTRAINT `tanneinotifications_from_user_id_foreign` FOREIGN KEY (`from_user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneinotifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneinotifications`
--


--
-- Table structure for table `tanneipost_likes`
--

CREATE TABLE `tanneipost_likes` (
  `post_id` int unsigned NOT NULL,
  `user_id` int unsigned NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`post_id`,`user_id`),
  KEY `tanneipost_likes_user_id_foreign` (`user_id`),
  CONSTRAINT `tanneipost_likes_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `tanneiposts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneipost_likes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneipost_likes`
--


--
-- Table structure for table `tanneipost_mentions_post`
--

CREATE TABLE `tanneipost_mentions_post` (
  `post_id` int unsigned NOT NULL,
  `mentions_post_id` int unsigned NOT NULL,
  PRIMARY KEY (`post_id`,`mentions_post_id`),
  KEY `tanneipost_mentions_post_mentions_post_id_foreign` (`mentions_post_id`),
  CONSTRAINT `tanneipost_mentions_post_mentions_post_id_foreign` FOREIGN KEY (`mentions_post_id`) REFERENCES `tanneiposts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneipost_mentions_post_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `tanneiposts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneipost_mentions_post`
--


--
-- Table structure for table `tanneipost_mentions_user`
--

CREATE TABLE `tanneipost_mentions_user` (
  `post_id` int unsigned NOT NULL,
  `mentions_user_id` int unsigned NOT NULL,
  PRIMARY KEY (`post_id`,`mentions_user_id`),
  KEY `tanneipost_mentions_user_mentions_user_id_foreign` (`mentions_user_id`),
  CONSTRAINT `tanneipost_mentions_user_mentions_user_id_foreign` FOREIGN KEY (`mentions_user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneipost_mentions_user_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `tanneiposts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneipost_mentions_user`
--


--
-- Table structure for table `tanneipost_user`
--

CREATE TABLE `tanneipost_user` (
  `post_id` int unsigned NOT NULL,
  `user_id` int unsigned NOT NULL,
  PRIMARY KEY (`post_id`,`user_id`),
  KEY `tanneipost_user_user_id_foreign` (`user_id`),
  CONSTRAINT `tanneipost_user_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `tanneiposts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneipost_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneipost_user`
--


--
-- Table structure for table `tanneiposts`
--

CREATE TABLE `tanneiposts` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `discussion_id` int unsigned NOT NULL,
  `number` int unsigned DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `user_id` int unsigned DEFAULT NULL,
  `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `content` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT ' ',
  `edited_at` datetime DEFAULT NULL,
  `edited_user_id` int unsigned DEFAULT NULL,
  `hidden_at` datetime DEFAULT NULL,
  `hidden_user_id` int unsigned DEFAULT NULL,
  `ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_private` tinyint(1) NOT NULL DEFAULT '0',
  `is_approved` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `tanneiposts_discussion_id_number_unique` (`discussion_id`,`number`),
  KEY `tanneiposts_edited_user_id_foreign` (`edited_user_id`),
  KEY `tanneiposts_hidden_user_id_foreign` (`hidden_user_id`),
  KEY `tanneiposts_discussion_id_number_index` (`discussion_id`,`number`),
  KEY `tanneiposts_discussion_id_created_at_index` (`discussion_id`,`created_at`),
  KEY `tanneiposts_user_id_created_at_index` (`user_id`,`created_at`),
  FULLTEXT KEY `content` (`content`),
  CONSTRAINT `tanneiposts_discussion_id_foreign` FOREIGN KEY (`discussion_id`) REFERENCES `tanneidiscussions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneiposts_edited_user_id_foreign` FOREIGN KEY (`edited_user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneiposts_hidden_user_id_foreign` FOREIGN KEY (`hidden_user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneiposts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneiposts`
--

INSERT INTO `tanneiposts` VALUES (2,2,1,'2022-05-18 14:50:48',1,'comment','<t><p>这是个中文帖子</p></t>',NULL,NULL,NULL,NULL,'60.10.12.243',0,1),(3,3,1,'2022-05-18 23:17:09',1,'comment','<t><p>哈哈</p></t>',NULL,NULL,NULL,NULL,'60.10.12.243',0,1),(4,4,1,'2022-05-19 00:21:45',1,'comment','<t><p>看脉脉上好多裁员的 什么时候会消停</p></t>',NULL,NULL,NULL,NULL,'60.10.12.243',0,1),(5,5,1,'2022-05-20 12:52:32',1,'comment','<t><p>感觉习惯了都</p></t>',NULL,NULL,NULL,NULL,'60.10.12.242',0,1);

--
-- Table structure for table `tanneitag_user`
--

CREATE TABLE `tanneitag_user` (
  `user_id` int unsigned NOT NULL,
  `tag_id` int unsigned NOT NULL,
  `marked_as_read_at` datetime DEFAULT NULL,
  `is_hidden` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_id`,`tag_id`),
  KEY `tanneitag_user_tag_id_foreign` (`tag_id`),
  CONSTRAINT `tanneitag_user_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `tanneitags` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tanneitag_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneitag_user`
--


--
-- Table structure for table `tanneitags`
--

CREATE TABLE `tanneitags` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `slug` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `color` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `background_path` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `background_mode` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `position` int DEFAULT NULL,
  `parent_id` int unsigned DEFAULT NULL,
  `default_sort` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_restricted` tinyint(1) NOT NULL DEFAULT '0',
  `is_hidden` tinyint(1) NOT NULL DEFAULT '0',
  `discussion_count` int unsigned NOT NULL DEFAULT '0',
  `last_posted_at` datetime DEFAULT NULL,
  `last_posted_discussion_id` int unsigned DEFAULT NULL,
  `last_posted_user_id` int unsigned DEFAULT NULL,
  `icon` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `tanneitags_slug_unique` (`slug`),
  KEY `tanneitags_parent_id_foreign` (`parent_id`),
  KEY `tanneitags_last_posted_user_id_foreign` (`last_posted_user_id`),
  KEY `tanneitags_last_posted_discussion_id_foreign` (`last_posted_discussion_id`),
  CONSTRAINT `tanneitags_last_posted_discussion_id_foreign` FOREIGN KEY (`last_posted_discussion_id`) REFERENCES `tanneidiscussions` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneitags_last_posted_user_id_foreign` FOREIGN KEY (`last_posted_user_id`) REFERENCES `tanneiusers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tanneitags_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `tanneitags` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tanneitags`
--

INSERT INTO `tanneitags` VALUES (1,'General','general',NULL,'#888',NULL,NULL,0,NULL,NULL,0,0,3,'2022-05-20 12:52:32',5,1,NULL);


