Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- phpMyAdmin SQL Dump
- -- version 4.9.2
- -- https://www.phpmyadmin.net/
- --
- -- Host: 127.0.0.1:3306
- -- Generation Time: Mar 15, 2021 at 09:45 PM
- -- Server version: 10.4.10-MariaDB
- -- PHP Version: 7.3.12
- SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
- SET AUTOCOMMIT = 0;
- START TRANSACTION;
- SET time_zone = "+00:00";
- /*!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 */;
- --
- -- Database: `flarumclean`
- --
- -- --------------------------------------------------------
- --
- -- Table structure for table `access_tokens`
- --
- DROP TABLE IF EXISTS `access_tokens`;
- CREATE TABLE IF NOT EXISTS `access_tokens` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `token` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
- `user_id` int(10) UNSIGNED NOT NULL,
- `last_activity_at` datetime NOT NULL,
- `created_at` datetime NOT NULL,
- `type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `title` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `last_ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `last_user_agent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `access_tokens_token_unique` (`token`),
- KEY `access_tokens_user_id_foreign` (`user_id`),
- KEY `access_tokens_type_index` (`type`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `api_keys`
- --
- DROP TABLE IF EXISTS `api_keys`;
- CREATE TABLE IF NOT EXISTS `api_keys` (
- `key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `allowed_ips` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `scopes` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `user_id` int(10) UNSIGNED DEFAULT NULL,
- `created_at` datetime NOT NULL,
- `last_activity_at` datetime DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `api_keys_key_unique` (`key`),
- KEY `api_keys_user_id_foreign` (`user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `discussions`
- --
- DROP TABLE IF EXISTS `discussions`;
- CREATE TABLE IF NOT EXISTS `discussions` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
- `comment_count` int(11) NOT NULL DEFAULT 1,
- `participant_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
- `post_number_index` int(10) UNSIGNED NOT NULL DEFAULT 0,
- `created_at` datetime NOT NULL,
- `user_id` int(10) UNSIGNED DEFAULT NULL,
- `first_post_id` int(10) UNSIGNED DEFAULT NULL,
- `last_posted_at` datetime DEFAULT NULL,
- `last_posted_user_id` int(10) UNSIGNED DEFAULT NULL,
- `last_post_id` int(10) UNSIGNED DEFAULT NULL,
- `last_post_number` int(10) UNSIGNED DEFAULT NULL,
- `hidden_at` datetime DEFAULT NULL,
- `hidden_user_id` int(10) UNSIGNED DEFAULT NULL,
- `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `is_private` tinyint(1) NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`),
- KEY `discussions_hidden_user_id_foreign` (`hidden_user_id`),
- KEY `discussions_first_post_id_foreign` (`first_post_id`),
- KEY `discussions_last_post_id_foreign` (`last_post_id`),
- KEY `discussions_last_posted_at_index` (`last_posted_at`),
- KEY `discussions_last_posted_user_id_index` (`last_posted_user_id`),
- KEY `discussions_created_at_index` (`created_at`),
- KEY `discussions_user_id_index` (`user_id`),
- KEY `discussions_comment_count_index` (`comment_count`),
- KEY `discussions_participant_count_index` (`participant_count`),
- KEY `discussions_hidden_at_index` (`hidden_at`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `discussion_user`
- --
- DROP TABLE IF EXISTS `discussion_user`;
- CREATE TABLE IF NOT EXISTS `discussion_user` (
- `user_id` int(10) UNSIGNED NOT NULL,
- `discussion_id` int(10) UNSIGNED NOT NULL,
- `last_read_at` datetime DEFAULT NULL,
- `last_read_post_number` int(10) UNSIGNED DEFAULT NULL,
- PRIMARY KEY (`user_id`,`discussion_id`),
- KEY `discussion_user_discussion_id_foreign` (`discussion_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `email_tokens`
- --
- DROP TABLE IF EXISTS `email_tokens`;
- CREATE TABLE IF NOT EXISTS `email_tokens` (
- `token` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `email` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
- `user_id` int(10) UNSIGNED NOT NULL,
- `created_at` datetime DEFAULT NULL,
- PRIMARY KEY (`token`),
- KEY `email_tokens_user_id_foreign` (`user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `groups`
- --
- DROP TABLE IF EXISTS `groups`;
- CREATE TABLE IF NOT EXISTS `groups` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `name_singular` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `name_plural` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `color` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `icon` varchar(100) 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 `groups`
- --
- INSERT INTO `groups` (`id`, `name_singular`, `name_plural`, `color`, `icon`, `is_hidden`) 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 `group_permission`
- --
- DROP TABLE IF EXISTS `group_permission`;
- CREATE TABLE IF NOT EXISTS `group_permission` (
- `group_id` int(10) UNSIGNED NOT NULL,
- `permission` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- PRIMARY KEY (`group_id`,`permission`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- --
- -- Dumping data for table `group_permission`
- --
- INSERT INTO `group_permission` (`group_id`, `permission`) VALUES
- (2, 'viewDiscussions'),
- (3, 'discussion.reply'),
- (3, 'startDiscussion'),
- (3, 'viewUserList'),
- (4, 'discussion.editPosts'),
- (4, 'discussion.hide'),
- (4, 'discussion.hidePosts'),
- (4, 'discussion.rename'),
- (4, 'discussion.viewIpsPosts'),
- (4, 'user.viewLastSeenAt');
- -- --------------------------------------------------------
- --
- -- Table structure for table `group_user`
- --
- DROP TABLE IF EXISTS `group_user`;
- CREATE TABLE IF NOT EXISTS `group_user` (
- `user_id` int(10) UNSIGNED NOT NULL,
- `group_id` int(10) UNSIGNED NOT NULL,
- PRIMARY KEY (`user_id`,`group_id`),
- KEY `group_user_group_id_foreign` (`group_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `login_providers`
- --
- DROP TABLE IF EXISTS `login_providers`;
- CREATE TABLE IF NOT EXISTS `login_providers` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `user_id` int(10) UNSIGNED NOT NULL,
- `provider` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `identifier` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `created_at` datetime DEFAULT NULL,
- `last_login_at` datetime DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `login_providers_provider_identifier_unique` (`provider`,`identifier`),
- KEY `login_providers_user_id_foreign` (`user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `migrations`
- --
- DROP TABLE IF EXISTS `migrations`;
- CREATE TABLE IF NOT EXISTS `migrations` (
- `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `extension` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- --
- -- Dumping data for table `migrations`
- --
- INSERT INTO `migrations` (`migration`, `extension`) VALUES
- ('2015_02_24_000000_create_access_tokens_table', NULL),
- ('2015_02_24_000000_create_api_keys_table', NULL),
- ('2015_02_24_000000_create_config_table', NULL),
- ('2015_02_24_000000_create_discussions_table', NULL),
- ('2015_02_24_000000_create_email_tokens_table', NULL),
- ('2015_02_24_000000_create_groups_table', NULL),
- ('2015_02_24_000000_create_notifications_table', NULL),
- ('2015_02_24_000000_create_password_tokens_table', NULL),
- ('2015_02_24_000000_create_permissions_table', NULL),
- ('2015_02_24_000000_create_posts_table', NULL),
- ('2015_02_24_000000_create_users_discussions_table', NULL),
- ('2015_02_24_000000_create_users_groups_table', NULL),
- ('2015_02_24_000000_create_users_table', NULL),
- ('2015_09_15_000000_create_auth_tokens_table', NULL),
- ('2015_09_20_224327_add_hide_to_discussions', NULL),
- ('2015_09_22_030432_rename_notification_read_time', NULL),
- ('2015_10_07_130531_rename_config_to_settings', NULL),
- ('2015_10_24_194000_add_ip_address_to_posts', NULL),
- ('2015_12_05_042721_change_access_tokens_columns', NULL),
- ('2015_12_17_194247_change_settings_value_column_to_text', NULL),
- ('2016_02_04_095452_add_slug_to_discussions', NULL),
- ('2017_04_07_114138_add_is_private_to_discussions', NULL),
- ('2017_04_07_114138_add_is_private_to_posts', NULL),
- ('2018_01_11_093900_change_access_tokens_columns', NULL),
- ('2018_01_11_094000_change_access_tokens_add_foreign_keys', NULL),
- ('2018_01_11_095000_change_api_keys_columns', NULL),
- ('2018_01_11_101800_rename_auth_tokens_to_registration_tokens', NULL),
- ('2018_01_11_102000_change_registration_tokens_rename_id_to_token', NULL),
- ('2018_01_11_102100_change_registration_tokens_created_at_to_datetime', NULL),
- ('2018_01_11_120604_change_posts_table_to_innodb', NULL),
- ('2018_01_11_155200_change_discussions_rename_columns', NULL),
- ('2018_01_11_155300_change_discussions_add_foreign_keys', NULL),
- ('2018_01_15_071700_rename_users_discussions_to_discussion_user', NULL),
- ('2018_01_15_071800_change_discussion_user_rename_columns', NULL),
- ('2018_01_15_071900_change_discussion_user_add_foreign_keys', NULL),
- ('2018_01_15_072600_change_email_tokens_rename_id_to_token', NULL),
- ('2018_01_15_072700_change_email_tokens_add_foreign_keys', NULL),
- ('2018_01_15_072800_change_email_tokens_created_at_to_datetime', NULL),
- ('2018_01_18_130400_rename_permissions_to_group_permission', NULL),
- ('2018_01_18_130500_change_group_permission_add_foreign_keys', NULL),
- ('2018_01_18_130600_rename_users_groups_to_group_user', NULL),
- ('2018_01_18_130700_change_group_user_add_foreign_keys', NULL),
- ('2018_01_18_133000_change_notifications_columns', NULL),
- ('2018_01_18_133100_change_notifications_add_foreign_keys', NULL),
- ('2018_01_18_134400_change_password_tokens_rename_id_to_token', NULL),
- ('2018_01_18_134500_change_password_tokens_add_foreign_keys', NULL),
- ('2018_01_18_134600_change_password_tokens_created_at_to_datetime', NULL),
- ('2018_01_18_135000_change_posts_rename_columns', NULL),
- ('2018_01_18_135100_change_posts_add_foreign_keys', NULL),
- ('2018_01_30_112238_add_fulltext_index_to_discussions_title', NULL),
- ('2018_01_30_220100_create_post_user_table', NULL),
- ('2018_01_30_222900_change_users_rename_columns', NULL),
- ('2018_07_21_000000_seed_default_groups', NULL),
- ('2018_07_21_000100_seed_default_group_permissions', NULL),
- ('2018_09_15_041340_add_users_indicies', NULL),
- ('2018_09_15_041828_add_discussions_indicies', NULL),
- ('2018_09_15_043337_add_notifications_indices', NULL),
- ('2018_09_15_043621_add_posts_indices', NULL),
- ('2018_09_22_004100_change_registration_tokens_columns', NULL),
- ('2018_09_22_004200_create_login_providers_table', NULL),
- ('2018_10_08_144700_add_shim_prefix_to_group_icons', NULL),
- ('2019_06_24_145100_change_posts_content_column_to_mediumtext', NULL),
- ('2019_10_12_195349_change_posts_add_discussion_foreign_key', NULL),
- ('2020_03_19_134512_change_discussions_default_comment_count', NULL),
- ('2020_04_21_130500_change_permission_groups_add_is_hidden', NULL),
- ('2021_03_02_040000_change_access_tokens_add_type', NULL),
- ('2021_03_02_040500_change_access_tokens_add_id', NULL),
- ('2021_03_02_041000_change_access_tokens_add_title_ip_agent', NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `notifications`
- --
- DROP TABLE IF EXISTS `notifications`;
- CREATE TABLE IF NOT EXISTS `notifications` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `user_id` int(10) UNSIGNED NOT NULL,
- `from_user_id` int(10) UNSIGNED DEFAULT NULL,
- `type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `subject_id` int(10) UNSIGNED DEFAULT NULL,
- `data` blob DEFAULT NULL,
- `created_at` datetime NOT NULL,
- `is_deleted` tinyint(1) NOT NULL DEFAULT 0,
- `read_at` datetime DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `notifications_from_user_id_foreign` (`from_user_id`),
- KEY `notifications_user_id_index` (`user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `password_tokens`
- --
- DROP TABLE IF EXISTS `password_tokens`;
- CREATE TABLE IF NOT EXISTS `password_tokens` (
- `token` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `user_id` int(10) UNSIGNED NOT NULL,
- `created_at` datetime DEFAULT NULL,
- PRIMARY KEY (`token`),
- KEY `password_tokens_user_id_foreign` (`user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `posts`
- --
- DROP TABLE IF EXISTS `posts`;
- CREATE TABLE IF NOT EXISTS `posts` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `discussion_id` int(10) UNSIGNED NOT NULL,
- `number` int(10) UNSIGNED DEFAULT NULL,
- `created_at` datetime NOT NULL,
- `user_id` int(10) UNSIGNED DEFAULT NULL,
- `type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `content` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ' ',
- `edited_at` datetime DEFAULT NULL,
- `edited_user_id` int(10) UNSIGNED DEFAULT NULL,
- `hidden_at` datetime DEFAULT NULL,
- `hidden_user_id` int(10) UNSIGNED DEFAULT NULL,
- `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `is_private` tinyint(1) NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`),
- UNIQUE KEY `posts_discussion_id_number_unique` (`discussion_id`,`number`),
- KEY `posts_edited_user_id_foreign` (`edited_user_id`),
- KEY `posts_hidden_user_id_foreign` (`hidden_user_id`),
- KEY `posts_discussion_id_number_index` (`discussion_id`,`number`),
- KEY `posts_discussion_id_created_at_index` (`discussion_id`,`created_at`),
- KEY `posts_user_id_created_at_index` (`user_id`,`created_at`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `post_user`
- --
- DROP TABLE IF EXISTS `post_user`;
- CREATE TABLE IF NOT EXISTS `post_user` (
- `post_id` int(10) UNSIGNED NOT NULL,
- `user_id` int(10) UNSIGNED NOT NULL,
- PRIMARY KEY (`post_id`,`user_id`),
- KEY `post_user_user_id_foreign` (`user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `registration_tokens`
- --
- DROP TABLE IF EXISTS `registration_tokens`;
- CREATE TABLE IF NOT EXISTS `registration_tokens` (
- `token` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `payload` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `created_at` datetime DEFAULT NULL,
- `provider` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `user_attributes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- PRIMARY KEY (`token`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- --------------------------------------------------------
- --
- -- Table structure for table `settings`
- --
- DROP TABLE IF EXISTS `settings`;
- CREATE TABLE IF NOT EXISTS `settings` (
- `key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `value` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- PRIMARY KEY (`key`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- --
- -- Dumping data for table `settings`
- --
- INSERT INTO `settings` (`key`, `value`) VALUES
- ('version', '0.1.0-beta.16');
- -- --------------------------------------------------------
- --
- -- Table structure for table `users`
- --
- DROP TABLE IF EXISTS `users`;
- CREATE TABLE IF NOT EXISTS `users` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `username` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `email` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
- `is_email_confirmed` tinyint(1) NOT NULL DEFAULT 0,
- `password` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
- `avatar_url` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `preferences` blob DEFAULT NULL,
- `joined_at` datetime DEFAULT NULL,
- `last_seen_at` datetime DEFAULT NULL,
- `marked_all_as_read_at` datetime DEFAULT NULL,
- `read_notifications_at` datetime DEFAULT NULL,
- `discussion_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
- `comment_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`),
- UNIQUE KEY `users_username_unique` (`username`),
- UNIQUE KEY `users_email_unique` (`email`),
- KEY `users_joined_at_index` (`joined_at`),
- KEY `users_last_seen_at_index` (`last_seen_at`),
- KEY `users_discussion_count_index` (`discussion_count`),
- KEY `users_comment_count_index` (`comment_count`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- --
- -- Indexes for dumped tables
- --
- --
- -- Indexes for table `discussions`
- --
- ALTER TABLE `discussions` ADD FULLTEXT KEY `title` (`title`);
- --
- -- Indexes for table `posts`
- --
- ALTER TABLE `posts` ADD FULLTEXT KEY `content` (`content`);
- --
- -- Constraints for dumped tables
- --
- --
- -- Constraints for table `access_tokens`
- --
- ALTER TABLE `access_tokens`
- ADD CONSTRAINT `access_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `api_keys`
- --
- ALTER TABLE `api_keys`
- ADD CONSTRAINT `api_keys_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `discussions`
- --
- ALTER TABLE `discussions`
- ADD CONSTRAINT `discussions_first_post_id_foreign` FOREIGN KEY (`first_post_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL,
- ADD CONSTRAINT `discussions_hidden_user_id_foreign` FOREIGN KEY (`hidden_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
- ADD CONSTRAINT `discussions_last_post_id_foreign` FOREIGN KEY (`last_post_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL,
- ADD CONSTRAINT `discussions_last_posted_user_id_foreign` FOREIGN KEY (`last_posted_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
- ADD CONSTRAINT `discussions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;
- --
- -- Constraints for table `discussion_user`
- --
- ALTER TABLE `discussion_user`
- ADD CONSTRAINT `discussion_user_discussion_id_foreign` FOREIGN KEY (`discussion_id`) REFERENCES `discussions` (`id`) ON DELETE CASCADE,
- ADD CONSTRAINT `discussion_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `email_tokens`
- --
- ALTER TABLE `email_tokens`
- ADD CONSTRAINT `email_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `group_permission`
- --
- ALTER TABLE `group_permission`
- ADD CONSTRAINT `group_permission_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `group_user`
- --
- ALTER TABLE `group_user`
- ADD CONSTRAINT `group_user_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE,
- ADD CONSTRAINT `group_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `login_providers`
- --
- ALTER TABLE `login_providers`
- ADD CONSTRAINT `login_providers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `notifications`
- --
- ALTER TABLE `notifications`
- ADD CONSTRAINT `notifications_from_user_id_foreign` FOREIGN KEY (`from_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
- ADD CONSTRAINT `notifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `password_tokens`
- --
- ALTER TABLE `password_tokens`
- ADD CONSTRAINT `password_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- --
- -- Constraints for table `posts`
- --
- ALTER TABLE `posts`
- ADD CONSTRAINT `posts_discussion_id_foreign` FOREIGN KEY (`discussion_id`) REFERENCES `discussions` (`id`) ON DELETE CASCADE,
- ADD CONSTRAINT `posts_edited_user_id_foreign` FOREIGN KEY (`edited_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
- ADD CONSTRAINT `posts_hidden_user_id_foreign` FOREIGN KEY (`hidden_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
- ADD CONSTRAINT `posts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;
- --
- -- Constraints for table `post_user`
- --
- ALTER TABLE `post_user`
- ADD CONSTRAINT `post_user_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE,
- ADD CONSTRAINT `post_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
- COMMIT;
- /*!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 */;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement