Advertisement
Guest User

Untitled

a guest
Mar 15th, 2021
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 22.09 KB | None | 0 0
  1. -- phpMyAdmin SQL Dump
  2. -- version 4.9.2
  3. -- https://www.phpmyadmin.net/
  4. --
  5. -- Host: 127.0.0.1:3306
  6. -- Generation Time: Mar 15, 2021 at 09:45 PM
  7. -- Server version: 10.4.10-MariaDB
  8. -- PHP Version: 7.3.12
  9.  
  10. SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  11. SET AUTOCOMMIT = 0;
  12. START TRANSACTION;
  13. SET time_zone = "+00:00";
  14.  
  15.  
  16. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  17. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  18. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  19. /*!40101 SET NAMES utf8mb4 */;
  20.  
  21. --
  22. -- Database: `flarumclean`
  23. --
  24.  
  25. -- --------------------------------------------------------
  26.  
  27. --
  28. -- Table structure for table `access_tokens`
  29. --
  30.  
  31. DROP TABLE IF EXISTS `access_tokens`;
  32. CREATE TABLE IF NOT EXISTS `access_tokens` (
  33.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  34.   `token` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
  35.   `user_id` int(10) UNSIGNED NOT NULL,
  36.   `last_activity_at` datetime NOT NULL,
  37.   `created_at` datetime NOT NULL,
  38.   `type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  39.   `title` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  40.   `last_ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  41.   `last_user_agent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  42.   PRIMARY KEY (`id`),
  43.   UNIQUE KEY `access_tokens_token_unique` (`token`),
  44.   KEY `access_tokens_user_id_foreign` (`user_id`),
  45.   KEY `access_tokens_type_index` (`type`)
  46. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  47.  
  48. -- --------------------------------------------------------
  49.  
  50. --
  51. -- Table structure for table `api_keys`
  52. --
  53.  
  54. DROP TABLE IF EXISTS `api_keys`;
  55. CREATE TABLE IF NOT EXISTS `api_keys` (
  56.   `key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  57.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  58.   `allowed_ips` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  59.   `scopes` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  60.   `user_id` int(10) UNSIGNED DEFAULT NULL,
  61.   `created_at` datetime NOT NULL,
  62.   `last_activity_at` datetime DEFAULT NULL,
  63.   PRIMARY KEY (`id`),
  64.   UNIQUE KEY `api_keys_key_unique` (`key`),
  65.   KEY `api_keys_user_id_foreign` (`user_id`)
  66. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  67.  
  68. -- --------------------------------------------------------
  69.  
  70. --
  71. -- Table structure for table `discussions`
  72. --
  73.  
  74. DROP TABLE IF EXISTS `discussions`;
  75. CREATE TABLE IF NOT EXISTS `discussions` (
  76.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  77.   `title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  78.   `comment_count` int(11) NOT NULL DEFAULT 1,
  79.   `participant_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  80.   `post_number_index` int(10) UNSIGNED NOT NULL DEFAULT 0,
  81.   `created_at` datetime NOT NULL,
  82.   `user_id` int(10) UNSIGNED DEFAULT NULL,
  83.   `first_post_id` int(10) UNSIGNED DEFAULT NULL,
  84.   `last_posted_at` datetime DEFAULT NULL,
  85.   `last_posted_user_id` int(10) UNSIGNED DEFAULT NULL,
  86.   `last_post_id` int(10) UNSIGNED DEFAULT NULL,
  87.   `last_post_number` int(10) UNSIGNED DEFAULT NULL,
  88.   `hidden_at` datetime DEFAULT NULL,
  89.   `hidden_user_id` int(10) UNSIGNED DEFAULT NULL,
  90.   `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  91.   `is_private` tinyint(1) NOT NULL DEFAULT 0,
  92.   PRIMARY KEY (`id`),
  93.   KEY `discussions_hidden_user_id_foreign` (`hidden_user_id`),
  94.   KEY `discussions_first_post_id_foreign` (`first_post_id`),
  95.   KEY `discussions_last_post_id_foreign` (`last_post_id`),
  96.   KEY `discussions_last_posted_at_index` (`last_posted_at`),
  97.   KEY `discussions_last_posted_user_id_index` (`last_posted_user_id`),
  98.   KEY `discussions_created_at_index` (`created_at`),
  99.   KEY `discussions_user_id_index` (`user_id`),
  100.   KEY `discussions_comment_count_index` (`comment_count`),
  101.   KEY `discussions_participant_count_index` (`participant_count`),
  102.   KEY `discussions_hidden_at_index` (`hidden_at`)
  103. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  104.  
  105. -- --------------------------------------------------------
  106.  
  107. --
  108. -- Table structure for table `discussion_user`
  109. --
  110.  
  111. DROP TABLE IF EXISTS `discussion_user`;
  112. CREATE TABLE IF NOT EXISTS `discussion_user` (
  113.   `user_id` int(10) UNSIGNED NOT NULL,
  114.   `discussion_id` int(10) UNSIGNED NOT NULL,
  115.   `last_read_at` datetime DEFAULT NULL,
  116.   `last_read_post_number` int(10) UNSIGNED DEFAULT NULL,
  117.   PRIMARY KEY (`user_id`,`discussion_id`),
  118.   KEY `discussion_user_discussion_id_foreign` (`discussion_id`)
  119. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  120.  
  121. -- --------------------------------------------------------
  122.  
  123. --
  124. -- Table structure for table `email_tokens`
  125. --
  126.  
  127. DROP TABLE IF EXISTS `email_tokens`;
  128. CREATE TABLE IF NOT EXISTS `email_tokens` (
  129.   `token` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  130.   `email` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  131.   `user_id` int(10) UNSIGNED NOT NULL,
  132.   `created_at` datetime DEFAULT NULL,
  133.   PRIMARY KEY (`token`),
  134.   KEY `email_tokens_user_id_foreign` (`user_id`)
  135. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  136.  
  137. -- --------------------------------------------------------
  138.  
  139. --
  140. -- Table structure for table `groups`
  141. --
  142.  
  143. DROP TABLE IF EXISTS `groups`;
  144. CREATE TABLE IF NOT EXISTS `groups` (
  145.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  146.   `name_singular` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  147.   `name_plural` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  148.   `color` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  149.   `icon` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  150.   `is_hidden` tinyint(1) NOT NULL DEFAULT 0,
  151.   PRIMARY KEY (`id`)
  152. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  153.  
  154. --
  155. -- Dumping data for table `groups`
  156. --
  157.  
  158. INSERT INTO `groups` (`id`, `name_singular`, `name_plural`, `color`, `icon`, `is_hidden`) VALUES
  159. (1, 'Admin', 'Admins', '#B72A2A', 'fas fa-wrench', 0),
  160. (2, 'Guest', 'Guests', NULL, NULL, 0),
  161. (3, 'Member', 'Members', NULL, NULL, 0),
  162. (4, 'Mod', 'Mods', '#80349E', 'fas fa-bolt', 0);
  163.  
  164. -- --------------------------------------------------------
  165.  
  166. --
  167. -- Table structure for table `group_permission`
  168. --
  169.  
  170. DROP TABLE IF EXISTS `group_permission`;
  171. CREATE TABLE IF NOT EXISTS `group_permission` (
  172.   `group_id` int(10) UNSIGNED NOT NULL,
  173.   `permission` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  174.   PRIMARY KEY (`group_id`,`permission`)
  175. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  176.  
  177. --
  178. -- Dumping data for table `group_permission`
  179. --
  180.  
  181. INSERT INTO `group_permission` (`group_id`, `permission`) VALUES
  182. (2, 'viewDiscussions'),
  183. (3, 'discussion.reply'),
  184. (3, 'startDiscussion'),
  185. (3, 'viewUserList'),
  186. (4, 'discussion.editPosts'),
  187. (4, 'discussion.hide'),
  188. (4, 'discussion.hidePosts'),
  189. (4, 'discussion.rename'),
  190. (4, 'discussion.viewIpsPosts'),
  191. (4, 'user.viewLastSeenAt');
  192.  
  193. -- --------------------------------------------------------
  194.  
  195. --
  196. -- Table structure for table `group_user`
  197. --
  198.  
  199. DROP TABLE IF EXISTS `group_user`;
  200. CREATE TABLE IF NOT EXISTS `group_user` (
  201.   `user_id` int(10) UNSIGNED NOT NULL,
  202.   `group_id` int(10) UNSIGNED NOT NULL,
  203.   PRIMARY KEY (`user_id`,`group_id`),
  204.   KEY `group_user_group_id_foreign` (`group_id`)
  205. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  206.  
  207. -- --------------------------------------------------------
  208.  
  209. --
  210. -- Table structure for table `login_providers`
  211. --
  212.  
  213. DROP TABLE IF EXISTS `login_providers`;
  214. CREATE TABLE IF NOT EXISTS `login_providers` (
  215.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  216.   `user_id` int(10) UNSIGNED NOT NULL,
  217.   `provider` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  218.   `identifier` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  219.   `created_at` datetime DEFAULT NULL,
  220.   `last_login_at` datetime DEFAULT NULL,
  221.   PRIMARY KEY (`id`),
  222.   UNIQUE KEY `login_providers_provider_identifier_unique` (`provider`,`identifier`),
  223.   KEY `login_providers_user_id_foreign` (`user_id`)
  224. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  225.  
  226. -- --------------------------------------------------------
  227.  
  228. --
  229. -- Table structure for table `migrations`
  230. --
  231.  
  232. DROP TABLE IF EXISTS `migrations`;
  233. CREATE TABLE IF NOT EXISTS `migrations` (
  234.   `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  235.   `extension` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
  236. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  237.  
  238. --
  239. -- Dumping data for table `migrations`
  240. --
  241.  
  242. INSERT INTO `migrations` (`migration`, `extension`) VALUES
  243. ('2015_02_24_000000_create_access_tokens_table', NULL),
  244. ('2015_02_24_000000_create_api_keys_table', NULL),
  245. ('2015_02_24_000000_create_config_table', NULL),
  246. ('2015_02_24_000000_create_discussions_table', NULL),
  247. ('2015_02_24_000000_create_email_tokens_table', NULL),
  248. ('2015_02_24_000000_create_groups_table', NULL),
  249. ('2015_02_24_000000_create_notifications_table', NULL),
  250. ('2015_02_24_000000_create_password_tokens_table', NULL),
  251. ('2015_02_24_000000_create_permissions_table', NULL),
  252. ('2015_02_24_000000_create_posts_table', NULL),
  253. ('2015_02_24_000000_create_users_discussions_table', NULL),
  254. ('2015_02_24_000000_create_users_groups_table', NULL),
  255. ('2015_02_24_000000_create_users_table', NULL),
  256. ('2015_09_15_000000_create_auth_tokens_table', NULL),
  257. ('2015_09_20_224327_add_hide_to_discussions', NULL),
  258. ('2015_09_22_030432_rename_notification_read_time', NULL),
  259. ('2015_10_07_130531_rename_config_to_settings', NULL),
  260. ('2015_10_24_194000_add_ip_address_to_posts', NULL),
  261. ('2015_12_05_042721_change_access_tokens_columns', NULL),
  262. ('2015_12_17_194247_change_settings_value_column_to_text', NULL),
  263. ('2016_02_04_095452_add_slug_to_discussions', NULL),
  264. ('2017_04_07_114138_add_is_private_to_discussions', NULL),
  265. ('2017_04_07_114138_add_is_private_to_posts', NULL),
  266. ('2018_01_11_093900_change_access_tokens_columns', NULL),
  267. ('2018_01_11_094000_change_access_tokens_add_foreign_keys', NULL),
  268. ('2018_01_11_095000_change_api_keys_columns', NULL),
  269. ('2018_01_11_101800_rename_auth_tokens_to_registration_tokens', NULL),
  270. ('2018_01_11_102000_change_registration_tokens_rename_id_to_token', NULL),
  271. ('2018_01_11_102100_change_registration_tokens_created_at_to_datetime', NULL),
  272. ('2018_01_11_120604_change_posts_table_to_innodb', NULL),
  273. ('2018_01_11_155200_change_discussions_rename_columns', NULL),
  274. ('2018_01_11_155300_change_discussions_add_foreign_keys', NULL),
  275. ('2018_01_15_071700_rename_users_discussions_to_discussion_user', NULL),
  276. ('2018_01_15_071800_change_discussion_user_rename_columns', NULL),
  277. ('2018_01_15_071900_change_discussion_user_add_foreign_keys', NULL),
  278. ('2018_01_15_072600_change_email_tokens_rename_id_to_token', NULL),
  279. ('2018_01_15_072700_change_email_tokens_add_foreign_keys', NULL),
  280. ('2018_01_15_072800_change_email_tokens_created_at_to_datetime', NULL),
  281. ('2018_01_18_130400_rename_permissions_to_group_permission', NULL),
  282. ('2018_01_18_130500_change_group_permission_add_foreign_keys', NULL),
  283. ('2018_01_18_130600_rename_users_groups_to_group_user', NULL),
  284. ('2018_01_18_130700_change_group_user_add_foreign_keys', NULL),
  285. ('2018_01_18_133000_change_notifications_columns', NULL),
  286. ('2018_01_18_133100_change_notifications_add_foreign_keys', NULL),
  287. ('2018_01_18_134400_change_password_tokens_rename_id_to_token', NULL),
  288. ('2018_01_18_134500_change_password_tokens_add_foreign_keys', NULL),
  289. ('2018_01_18_134600_change_password_tokens_created_at_to_datetime', NULL),
  290. ('2018_01_18_135000_change_posts_rename_columns', NULL),
  291. ('2018_01_18_135100_change_posts_add_foreign_keys', NULL),
  292. ('2018_01_30_112238_add_fulltext_index_to_discussions_title', NULL),
  293. ('2018_01_30_220100_create_post_user_table', NULL),
  294. ('2018_01_30_222900_change_users_rename_columns', NULL),
  295. ('2018_07_21_000000_seed_default_groups', NULL),
  296. ('2018_07_21_000100_seed_default_group_permissions', NULL),
  297. ('2018_09_15_041340_add_users_indicies', NULL),
  298. ('2018_09_15_041828_add_discussions_indicies', NULL),
  299. ('2018_09_15_043337_add_notifications_indices', NULL),
  300. ('2018_09_15_043621_add_posts_indices', NULL),
  301. ('2018_09_22_004100_change_registration_tokens_columns', NULL),
  302. ('2018_09_22_004200_create_login_providers_table', NULL),
  303. ('2018_10_08_144700_add_shim_prefix_to_group_icons', NULL),
  304. ('2019_06_24_145100_change_posts_content_column_to_mediumtext', NULL),
  305. ('2019_10_12_195349_change_posts_add_discussion_foreign_key', NULL),
  306. ('2020_03_19_134512_change_discussions_default_comment_count', NULL),
  307. ('2020_04_21_130500_change_permission_groups_add_is_hidden', NULL),
  308. ('2021_03_02_040000_change_access_tokens_add_type', NULL),
  309. ('2021_03_02_040500_change_access_tokens_add_id', NULL),
  310. ('2021_03_02_041000_change_access_tokens_add_title_ip_agent', NULL);
  311.  
  312. -- --------------------------------------------------------
  313.  
  314. --
  315. -- Table structure for table `notifications`
  316. --
  317.  
  318. DROP TABLE IF EXISTS `notifications`;
  319. CREATE TABLE IF NOT EXISTS `notifications` (
  320.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  321.   `user_id` int(10) UNSIGNED NOT NULL,
  322.   `from_user_id` int(10) UNSIGNED DEFAULT NULL,
  323.   `type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  324.   `subject_id` int(10) UNSIGNED DEFAULT NULL,
  325.   `data` blob DEFAULT NULL,
  326.   `created_at` datetime NOT NULL,
  327.   `is_deleted` tinyint(1) NOT NULL DEFAULT 0,
  328.   `read_at` datetime DEFAULT NULL,
  329.   PRIMARY KEY (`id`),
  330.   KEY `notifications_from_user_id_foreign` (`from_user_id`),
  331.   KEY `notifications_user_id_index` (`user_id`)
  332. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  333.  
  334. -- --------------------------------------------------------
  335.  
  336. --
  337. -- Table structure for table `password_tokens`
  338. --
  339.  
  340. DROP TABLE IF EXISTS `password_tokens`;
  341. CREATE TABLE IF NOT EXISTS `password_tokens` (
  342.   `token` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  343.   `user_id` int(10) UNSIGNED NOT NULL,
  344.   `created_at` datetime DEFAULT NULL,
  345.   PRIMARY KEY (`token`),
  346.   KEY `password_tokens_user_id_foreign` (`user_id`)
  347. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  348.  
  349. -- --------------------------------------------------------
  350.  
  351. --
  352. -- Table structure for table `posts`
  353. --
  354.  
  355. DROP TABLE IF EXISTS `posts`;
  356. CREATE TABLE IF NOT EXISTS `posts` (
  357.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  358.   `discussion_id` int(10) UNSIGNED NOT NULL,
  359.   `number` int(10) UNSIGNED DEFAULT NULL,
  360.   `created_at` datetime NOT NULL,
  361.   `user_id` int(10) UNSIGNED DEFAULT NULL,
  362.   `type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  363.   `content` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ' ',
  364.   `edited_at` datetime DEFAULT NULL,
  365.   `edited_user_id` int(10) UNSIGNED DEFAULT NULL,
  366.   `hidden_at` datetime DEFAULT NULL,
  367.   `hidden_user_id` int(10) UNSIGNED DEFAULT NULL,
  368.   `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  369.   `is_private` tinyint(1) NOT NULL DEFAULT 0,
  370.   PRIMARY KEY (`id`),
  371.   UNIQUE KEY `posts_discussion_id_number_unique` (`discussion_id`,`number`),
  372.   KEY `posts_edited_user_id_foreign` (`edited_user_id`),
  373.   KEY `posts_hidden_user_id_foreign` (`hidden_user_id`),
  374.   KEY `posts_discussion_id_number_index` (`discussion_id`,`number`),
  375.   KEY `posts_discussion_id_created_at_index` (`discussion_id`,`created_at`),
  376.   KEY `posts_user_id_created_at_index` (`user_id`,`created_at`)
  377. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  378.  
  379. -- --------------------------------------------------------
  380.  
  381. --
  382. -- Table structure for table `post_user`
  383. --
  384.  
  385. DROP TABLE IF EXISTS `post_user`;
  386. CREATE TABLE IF NOT EXISTS `post_user` (
  387.   `post_id` int(10) UNSIGNED NOT NULL,
  388.   `user_id` int(10) UNSIGNED NOT NULL,
  389.   PRIMARY KEY (`post_id`,`user_id`),
  390.   KEY `post_user_user_id_foreign` (`user_id`)
  391. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  392.  
  393. -- --------------------------------------------------------
  394.  
  395. --
  396. -- Table structure for table `registration_tokens`
  397. --
  398.  
  399. DROP TABLE IF EXISTS `registration_tokens`;
  400. CREATE TABLE IF NOT EXISTS `registration_tokens` (
  401.   `token` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  402.   `payload` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  403.   `created_at` datetime DEFAULT NULL,
  404.   `provider` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  405.   `identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  406.   `user_attributes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  407.   PRIMARY KEY (`token`)
  408. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  409.  
  410. -- --------------------------------------------------------
  411.  
  412. --
  413. -- Table structure for table `settings`
  414. --
  415.  
  416. DROP TABLE IF EXISTS `settings`;
  417. CREATE TABLE IF NOT EXISTS `settings` (
  418.   `key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  419.   `value` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  420.   PRIMARY KEY (`key`)
  421. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  422.  
  423. --
  424. -- Dumping data for table `settings`
  425. --
  426.  
  427. INSERT INTO `settings` (`key`, `value`) VALUES
  428. ('version', '0.1.0-beta.16');
  429.  
  430. -- --------------------------------------------------------
  431.  
  432. --
  433. -- Table structure for table `users`
  434. --
  435.  
  436. DROP TABLE IF EXISTS `users`;
  437. CREATE TABLE IF NOT EXISTS `users` (
  438.   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  439.   `username` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  440.   `email` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  441.   `is_email_confirmed` tinyint(1) NOT NULL DEFAULT 0,
  442.   `password` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  443.   `avatar_url` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  444.   `preferences` blob DEFAULT NULL,
  445.   `joined_at` datetime DEFAULT NULL,
  446.   `last_seen_at` datetime DEFAULT NULL,
  447.   `marked_all_as_read_at` datetime DEFAULT NULL,
  448.   `read_notifications_at` datetime DEFAULT NULL,
  449.   `discussion_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  450.   `comment_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  451.   PRIMARY KEY (`id`),
  452.   UNIQUE KEY `users_username_unique` (`username`),
  453.   UNIQUE KEY `users_email_unique` (`email`),
  454.   KEY `users_joined_at_index` (`joined_at`),
  455.   KEY `users_last_seen_at_index` (`last_seen_at`),
  456.   KEY `users_discussion_count_index` (`discussion_count`),
  457.   KEY `users_comment_count_index` (`comment_count`)
  458. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  459.  
  460. --
  461. -- Indexes for dumped tables
  462. --
  463.  
  464. --
  465. -- Indexes for table `discussions`
  466. --
  467. ALTER TABLE `discussions` ADD FULLTEXT KEY `title` (`title`);
  468.  
  469. --
  470. -- Indexes for table `posts`
  471. --
  472. ALTER TABLE `posts` ADD FULLTEXT KEY `content` (`content`);
  473.  
  474. --
  475. -- Constraints for dumped tables
  476. --
  477.  
  478. --
  479. -- Constraints for table `access_tokens`
  480. --
  481. ALTER TABLE `access_tokens`
  482.   ADD CONSTRAINT `access_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  483.  
  484. --
  485. -- Constraints for table `api_keys`
  486. --
  487. ALTER TABLE `api_keys`
  488.   ADD CONSTRAINT `api_keys_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  489.  
  490. --
  491. -- Constraints for table `discussions`
  492. --
  493. ALTER TABLE `discussions`
  494.   ADD CONSTRAINT `discussions_first_post_id_foreign` FOREIGN KEY (`first_post_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL,
  495.   ADD CONSTRAINT `discussions_hidden_user_id_foreign` FOREIGN KEY (`hidden_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  496.   ADD CONSTRAINT `discussions_last_post_id_foreign` FOREIGN KEY (`last_post_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL,
  497.   ADD CONSTRAINT `discussions_last_posted_user_id_foreign` FOREIGN KEY (`last_posted_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  498.   ADD CONSTRAINT `discussions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;
  499.  
  500. --
  501. -- Constraints for table `discussion_user`
  502. --
  503. ALTER TABLE `discussion_user`
  504.   ADD CONSTRAINT `discussion_user_discussion_id_foreign` FOREIGN KEY (`discussion_id`) REFERENCES `discussions` (`id`) ON DELETE CASCADE,
  505.   ADD CONSTRAINT `discussion_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  506.  
  507. --
  508. -- Constraints for table `email_tokens`
  509. --
  510. ALTER TABLE `email_tokens`
  511.   ADD CONSTRAINT `email_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  512.  
  513. --
  514. -- Constraints for table `group_permission`
  515. --
  516. ALTER TABLE `group_permission`
  517.   ADD CONSTRAINT `group_permission_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE;
  518.  
  519. --
  520. -- Constraints for table `group_user`
  521. --
  522. ALTER TABLE `group_user`
  523.   ADD CONSTRAINT `group_user_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE,
  524.   ADD CONSTRAINT `group_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  525.  
  526. --
  527. -- Constraints for table `login_providers`
  528. --
  529. ALTER TABLE `login_providers`
  530.   ADD CONSTRAINT `login_providers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  531.  
  532. --
  533. -- Constraints for table `notifications`
  534. --
  535. ALTER TABLE `notifications`
  536.   ADD CONSTRAINT `notifications_from_user_id_foreign` FOREIGN KEY (`from_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  537.   ADD CONSTRAINT `notifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  538.  
  539. --
  540. -- Constraints for table `password_tokens`
  541. --
  542. ALTER TABLE `password_tokens`
  543.   ADD CONSTRAINT `password_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  544.  
  545. --
  546. -- Constraints for table `posts`
  547. --
  548. ALTER TABLE `posts`
  549.   ADD CONSTRAINT `posts_discussion_id_foreign` FOREIGN KEY (`discussion_id`) REFERENCES `discussions` (`id`) ON DELETE CASCADE,
  550.   ADD CONSTRAINT `posts_edited_user_id_foreign` FOREIGN KEY (`edited_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  551.   ADD CONSTRAINT `posts_hidden_user_id_foreign` FOREIGN KEY (`hidden_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  552.   ADD CONSTRAINT `posts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;
  553.  
  554. --
  555. -- Constraints for table `post_user`
  556. --
  557. ALTER TABLE `post_user`
  558.   ADD CONSTRAINT `post_user_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE,
  559.   ADD CONSTRAINT `post_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
  560. COMMIT;
  561.  
  562. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  563. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  564. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  565.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement