--
-- Host: 127.0.0.1    Database: aam
-- ------------------------------------------------------


--
-- Table structure for table `article`
--

CREATE TABLE `article` (
  `article_id` int unsigned NOT NULL AUTO_INCREMENT,
  `article_group_id` int unsigned NOT NULL,
  `sequence` int unsigned NOT NULL,
  `title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `slug` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`article_id`),
  KEY `fk_article_article_group` (`article_group_id`),
  CONSTRAINT `fk_article_article_group` FOREIGN KEY (`article_group_id`) REFERENCES `article_group` (`article_group_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `article`
--

INSERT INTO `article` VALUES (1,2,0,'Core Concepts: Introduction','introduction','2016-05-26 16:23:25','2020-03-19 15:34:58');
INSERT INTO `article` VALUES (2,2,1,'Astro/Atomic Symmetry','astro-atomic-symmetry','2016-05-26 16:23:25','2020-03-19 15:34:58');
INSERT INTO `article` VALUES (3,2,2,'Nuclei and Star Systems','nuclei-and-star-systems','2016-05-26 16:23:25','2017-12-12 17:00:00');
INSERT INTO `article` VALUES (4,2,3,'Electrons and Star Satellites','electrons-and-star-satellites','2016-05-26 16:23:25','2017-12-12 17:00:00');
INSERT INTO `article` VALUES (5,5,0,'Common Misconceptions','common-misconceptions','2016-05-26 16:23:25','2017-12-12 16:54:48');
INSERT INTO `article` VALUES (6,5,1,'The Hydrogen Atom','the-hydrogen-atom','2016-05-26 16:23:25','2017-12-12 16:54:48');
INSERT INTO `article` VALUES (7,5,2,'Spectrography','spectrography','2016-05-26 16:23:25','2017-12-12 16:54:48');
INSERT INTO `article` VALUES (8,7,0,'Electrostatics','electrostatics','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (9,7,1,'Magnetism','magnetism','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (10,7,2,'Electric Current','electric-current','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (11,7,3,'Electrical Induction','electrical-induction','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (12,7,4,'Electromagnetic Waves','electromagnetic-waves','2016-05-26 16:23:25','2017-12-12 16:59:43');
INSERT INTO `article` VALUES (13,8,1,'Cathode Rays','cathode-rays','2016-05-26 16:23:25','2017-12-28 15:57:07');
INSERT INTO `article` VALUES (14,8,2,'Photoelectric Effect','photoelectric-effect','2016-05-26 16:23:25','2017-12-28 15:57:07');
INSERT INTO `article` VALUES (15,8,3,'Oil Drop Experiment','oil-drop-experiment','2016-05-26 16:23:25','2017-12-28 15:57:07');
INSERT INTO `article` VALUES (16,8,4,'Double Slit Experiment','double-slit-experiment','2016-05-26 16:23:25','2017-12-28 15:57:07');
INSERT INTO `article` VALUES (17,9,0,'Star System Evolution','star-system-evolution','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (18,9,1,'Globular Clusters','globular-clusters','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (19,10,0,'Single Star Systems','single-star-systems','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (20,10,1,'Binary Systems','binary-systems','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (21,10,2,'Double Binary Systems','double-binary-systems','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article` VALUES (23,2,4,'Gravity and Electronic Charge','gravity-and-electric-charge',NULL,'2017-12-12 17:00:00');
INSERT INTO `article` VALUES (24,8,0,'Gold Foil Experiment','gold-foil-experiment','2017-12-28 15:56:37','2017-12-28 15:57:07');

--
-- Table structure for table `article_comment`
--

CREATE TABLE `article_comment` (
  `article_comment_id` int unsigned NOT NULL AUTO_INCREMENT,
  `comment_type_id` int unsigned NOT NULL DEFAULT '1',
  `comment_status_id` int unsigned NOT NULL,
  `user_id` int unsigned NOT NULL,
  `article_id` int unsigned NOT NULL,
  `parent_id` int unsigned DEFAULT NULL,
  `title` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `body` text COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`article_comment_id`),
  KEY `idx_article_comment_article_id` (`article_id`),
  KEY `idx_article_comment_parent_id` (`parent_id`),
  KEY `fk_article_comment_user_id` (`user_id`),
  KEY `fk_article_comment_comment_status_id` (`comment_status_id`),
  KEY `fk_article_comment_comment_type_id` (`comment_type_id`),
  CONSTRAINT `fk_article_comment_article_id` FOREIGN KEY (`article_id`) REFERENCES `article` (`article_id`) ON DELETE CASCADE,
  CONSTRAINT `fk_article_comment_comment_status_id` FOREIGN KEY (`comment_status_id`) REFERENCES `comment_status` (`comment_status_id`),
  CONSTRAINT `fk_article_comment_comment_type_id` FOREIGN KEY (`comment_type_id`) REFERENCES `comment_type` (`comment_type_id`),
  CONSTRAINT `fk_article_comment_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `article_comment` (`article_comment_id`) ON DELETE CASCADE,
  CONSTRAINT `fk_article_comment_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=189 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `article_comment`
--

INSERT INTO `article_comment` VALUES (105,1,2,1,17,NULL,NULL,'Repudiandae aut doloribus consequatur  suscipit enim sit eaque eos.','2016-05-26 16:23:25','2016-05-26 16:23:25');
INSERT INTO `article_comment` VALUES (106,1,2,1,18,NULL,NULL,'<p>Saepe quos quis vel molestiae</p>','2016-05-26 16:05:00','2016-05-26 16:05:00');
INSERT INTO `article_comment` VALUES (161,1,2,54,1,NULL,NULL,'<p>Test 1</p>','2017-03-07 18:03:00','2017-03-07 18:03:00');
INSERT INTO `article_comment` VALUES (162,1,2,55,23,NULL,NULL,'Test comment','2017-12-02 21:36:30','2017-12-02 21:37:44');
INSERT INTO `article_comment` VALUES (163,1,2,1,1,161,NULL,'Test reply','2017-03-07 18:41:41','2017-03-07 18:46:26');
INSERT INTO `article_comment` VALUES (164,1,2,54,1,163,NULL,'test reply 2xxx','2018-01-03 10:59:00','2018-01-08 13:01:00');
INSERT INTO `article_comment` VALUES (185,1,2,54,1,NULL,NULL,'<p>ss  fsdfsd sdfsdfsdfsdfs</p>\r\n','2020-04-06 16:32:33','2020-04-06 16:32:33');
INSERT INTO `article_comment` VALUES (186,1,1,57,1,NULL,NULL,'<p>khj k hkhklh kh lk</p>\r\n','2020-04-07 16:40:29','2020-04-07 16:40:29');
INSERT INTO `article_comment` VALUES (187,1,1,58,1,NULL,NULL,'<p>dfs fsdf dsfsdfsdfsdf sf</p>\r\n','2020-04-07 17:43:05','2020-04-07 17:43:05');
INSERT INTO `article_comment` VALUES (188,1,1,59,1,NULL,NULL,'<p>dfs fsdf dsfsdfsdfsdf sf</p>\r\n','2020-04-07 17:45:27','2020-04-07 17:45:27');

--
-- Table structure for table `article_group`
--

CREATE TABLE `article_group` (
  `article_group_id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `segment` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `parent_id` int DEFAULT NULL,
  `sequence` int NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`article_group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `article_group`
--

INSERT INTO `article_group` VALUES (1,'Root','root',NULL,0,NULL,NULL);
INSERT INTO `article_group` VALUES (2,'Core Concepts','core-concepts',1,0,NULL,'2017-12-10 22:09:51');
INSERT INTO `article_group` VALUES (3,'Atomic','atomic',1,1,NULL,NULL);
INSERT INTO `article_group` VALUES (4,'Astro','astro',1,2,NULL,NULL);
INSERT INTO `article_group` VALUES (5,'Core Concepts','core-concepts',3,0,NULL,NULL);
INSERT INTO `article_group` VALUES (6,'Chemistry','chemistry',3,1,NULL,NULL);
INSERT INTO `article_group` VALUES (7,'Electromagnetism','electromagnetism',3,2,NULL,NULL);
INSERT INTO `article_group` VALUES (8,'Discoveries and Phenomena','discoveries-and-phenomena',3,3,NULL,NULL);
INSERT INTO `article_group` VALUES (9,'Core Concepts','core-concepts',4,0,NULL,NULL);
INSERT INTO `article_group` VALUES (10,'Star Systems','star-systems',4,1,NULL,NULL);

--
-- Table structure for table `article_tag`
--

CREATE TABLE `article_tag` (
  `article_id` int unsigned NOT NULL,
  `tag_id` int unsigned NOT NULL,
  KEY `idx_article_tag_article_id` (`article_id`),
  KEY `idx_article_tag_tag_id` (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `article_tag`
--


--
-- Table structure for table `comment_status`
--

CREATE TABLE `comment_status` (
  `comment_status_id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `description` text COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`comment_status_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `comment_status`
--

INSERT INTO `comment_status` VALUES (1,'unverified','comment not verified',NULL,NULL);
INSERT INTO `comment_status` VALUES (2,'verified','comment verified',NULL,NULL);

--
-- Table structure for table `comment_type`
--

CREATE TABLE `comment_type` (
  `comment_type_id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` text COLLATE utf8_unicode_ci,
  PRIMARY KEY (`comment_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `comment_type`
--

INSERT INTO `comment_type` VALUES (1,'article-comment',NULL);
INSERT INTO `comment_type` VALUES (2,'article-topic',NULL);

--
-- Table structure for table `login_provider_stats`
--

CREATE TABLE `login_provider_stats` (
  `login_provider_stats_id` int unsigned NOT NULL AUTO_INCREMENT,
  `login_provider_id` int unsigned NOT NULL,
  `access_count` int unsigned NOT NULL,
  `last_accessed` datetime NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`login_provider_stats_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `login_provider_stats`
--


--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` VALUES (1,'2014_10_12_100000_create_password_resets_table',1);
INSERT INTO `migrations` VALUES (2,'2016_01_09_000100_create_email_verification_table',1);
INSERT INTO `migrations` VALUES (3,'2016_01_09_112309_create_article_group_table',1);
INSERT INTO `migrations` VALUES (4,'2016_01_09_235703_create_article_table',1);
INSERT INTO `migrations` VALUES (5,'2016_01_10_000600_create_user_status_table',1);
INSERT INTO `migrations` VALUES (6,'2016_01_10_000650_create_user_role_table',1);
INSERT INTO `migrations` VALUES (7,'2016_01_10_000754_create_user_table',1);
INSERT INTO `migrations` VALUES (8,'2016_01_10_000800_add_foreign_keys_to_user_table',1);
INSERT INTO `migrations` VALUES (9,'2016_01_10_000900_add_foreign_keys_to_email_verification_table',1);
INSERT INTO `migrations` VALUES (10,'2016_01_10_000950_add_foreign_keys_to_password_resets_table',1);
INSERT INTO `migrations` VALUES (11,'2016_01_10_000950_create_comment_status_table',1);
INSERT INTO `migrations` VALUES (12,'2016_01_10_001833_create_topic_table',1);
INSERT INTO `migrations` VALUES (13,'2016_01_10_001900_add_foreign_keys_to_topic_table',1);
INSERT INTO `migrations` VALUES (14,'2016_01_10_002041_create_comment_type_table',1);
INSERT INTO `migrations` VALUES (15,'2016_01_10_002043_create_article_comment_table',1);
INSERT INTO `migrations` VALUES (16,'2016_01_10_002044_add_foreign_keys_to_article_comment_table',1);
INSERT INTO `migrations` VALUES (17,'2016_01_10_002103_create_topic_comment_table',1);
INSERT INTO `migrations` VALUES (18,'2016_01_10_002104_add_foreign_keys_to_topic_comment_table',1);
INSERT INTO `migrations` VALUES (19,'2016_02_16_112011_create_tag_table',1);
INSERT INTO `migrations` VALUES (20,'2016_02_16_112819_create_article_tag_table',1);
INSERT INTO `migrations` VALUES (21,'2016_05_20_101001_create_sessions_table',1);
INSERT INTO `migrations` VALUES (22,'2017_01_05_124302_create_session_ubox',1);
INSERT INTO `migrations` VALUES (23,'2018_05_24_081220_create_login_provider_table',1);
INSERT INTO `migrations` VALUES (24,'2018_05_24_082759_create_login_provider_stats_table',1);
INSERT INTO `migrations` VALUES (25,'2018_05_25_202821_create_socialite_user_table',1);
INSERT INTO `migrations` VALUES (26,'2018_05_25_235334_add_foreign_keys_to_socialite_user',1);

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `user_id` int DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8_unicode_ci,
  `payload` text COLLATE utf8_unicode_ci NOT NULL,
  `last_activity` int NOT NULL,
  UNIQUE KEY `sessions_id_unique` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `sessions`
--


--
-- Table structure for table `tag`
--

CREATE TABLE `tag` (
  `tag_id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`tag_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `tag`
--

INSERT INTO `tag` VALUES (1,'atomic physics','2020-02-29 16:22:59','2020-02-29 16:22:59');
INSERT INTO `tag` VALUES (2,'atomic experiments','2020-02-29 16:22:59','2020-02-29 16:22:59');
INSERT INTO `tag` VALUES (3,'astronomy','2020-02-29 16:22:59','2020-02-29 16:22:59');
INSERT INTO `tag` VALUES (4,'astrophysics','2020-02-29 16:22:59','2020-02-29 16:22:59');
INSERT INTO `tag` VALUES (5,'chemistry','2020-02-29 16:22:59','2020-02-29 16:22:59');

--
-- Table structure for table `topic`
--

CREATE TABLE `topic` (
  `topic_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `article_id` int unsigned NOT NULL,
  `title` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `body` text COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`topic_id`),
  KEY `idx_topic_user_id` (`user_id`),
  KEY `idx_topic_article_id` (`article_id`),
  CONSTRAINT `fk_topic_article_id` FOREIGN KEY (`article_id`) REFERENCES `article` (`article_id`) ON DELETE CASCADE,
  CONSTRAINT `fk_topic_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `topic`
--


--
-- Table structure for table `topic_comment`
--

CREATE TABLE `topic_comment` (
  `topic_comment_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL,
  `topic_id` int unsigned NOT NULL,
  `parent_id` int unsigned NOT NULL,
  `comment_status_id` int unsigned NOT NULL,
  `body` text COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`topic_comment_id`),
  KEY `idx_topic_comment_user_id` (`user_id`),
  KEY `idx_topic_comment_topic_id` (`topic_id`),
  KEY `fk_topic_comment_parent_id_idx` (`parent_id`),
  KEY `fk_topic_comment_comment_status_id` (`comment_status_id`),
  CONSTRAINT `fk_topic_comment_comment_status_id` FOREIGN KEY (`comment_status_id`) REFERENCES `comment_status` (`comment_status_id`),
  CONSTRAINT `fk_topic_comment_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `topic_comment` (`topic_comment_id`) ON DELETE CASCADE,
  CONSTRAINT `fk_topic_comment_topic_id` FOREIGN KEY (`topic_id`) REFERENCES `topic` (`topic_id`) ON DELETE CASCADE,
  CONSTRAINT `fk_topic_comment_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `topic_comment`
--


--
-- Table structure for table `user_role`
--

CREATE TABLE `user_role` (
  `user_role_id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `slug` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`user_role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `user_role`
--

INSERT INTO `user_role` VALUES (1,'Subscriber','subscriber');
INSERT INTO `user_role` VALUES (2,'Contributor','contributor');
INSERT INTO `user_role` VALUES (3,'Author','author');
INSERT INTO `user_role` VALUES (4,'Editor','editor');
INSERT INTO `user_role` VALUES (5,'Administrator','administrator');
INSERT INTO `user_role` VALUES (6,'Super Admin','super_admin');

--
-- Table structure for table `user_status`
--

CREATE TABLE `user_status` (
  `user_status_id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `description` text COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`user_status_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `user_status`
--

INSERT INTO `user_status` VALUES (1,'unverified','email not verified',NULL,NULL);
INSERT INTO `user_status` VALUES (2,'verified','email verified',NULL,NULL);
INSERT INTO `user_status` VALUES (4,'guest','guest',NULL,NULL);
INSERT INTO `user_status` VALUES (8,'registered','registered user',NULL,NULL);


