Fork Copy -- -------------------------------------------------------- -- Host: localhost -- Server version: 5.7.19 - MySQL Community Server (GPL) -- Server OS: Win64 -- HeidiSQL Version: 9.4.0.5125 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- Dumping structure for table xlearning.coupons DROP TABLE IF EXISTS `coupons`; CREATE TABLE IF NOT EXISTS `coupons` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `details` text COLLATE utf8mb4_unicode_ci NOT NULL, `type` int(11) NOT NULL, `range` int(11) NOT NULL, `from` datetime DEFAULT NULL, `to` datetime DEFAULT NULL, `total` int(10) unsigned DEFAULT NULL, `count` int(10) unsigned DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.coupons: ~0 rows (approximately) /*!40000 ALTER TABLE `coupons` DISABLE KEYS */; /*!40000 ALTER TABLE `coupons` ENABLE KEYS */; -- Dumping structure for table xlearning.courses DROP TABLE IF EXISTS `courses`; CREATE TABLE IF NOT EXISTS `courses` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci NOT NULL, `details` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `price` double NOT NULL, `max_students` int(11) NOT NULL, `type` int(10) unsigned DEFAULT NULL, `start_at` datetime NOT NULL, `end_at` datetime NOT NULL, `vote` int(11) DEFAULT NULL, `vote_count` int(11) DEFAULT NULL, `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `teacher_id` int(10) unsigned DEFAULT NULL, `public` tinyint(1) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `courses_teacher_id_foreign` (`teacher_id`), KEY `FK2_course_type` (`type`), CONSTRAINT `FK2_course_type` FOREIGN KEY (`type`) REFERENCES `course_type` (`id`), CONSTRAINT `courses_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.courses: ~0 rows (approximately) /*!40000 ALTER TABLE `courses` DISABLE KEYS */; /*!40000 ALTER TABLE `courses` ENABLE KEYS */; -- Dumping structure for table xlearning.course_type DROP TABLE IF EXISTS `course_type`; CREATE TABLE IF NOT EXISTS `course_type` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL DEFAULT '0', `details` text, `image` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Dumping data for table xlearning.course_type: ~0 rows (approximately) /*!40000 ALTER TABLE `course_type` DISABLE KEYS */; /*!40000 ALTER TABLE `course_type` ENABLE KEYS */; -- Dumping structure for table xlearning.course_user DROP TABLE IF EXISTS `course_user`; CREATE TABLE IF NOT EXISTS `course_user` ( `course_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, PRIMARY KEY (`course_id`,`user_id`), KEY `FK2_users` (`user_id`), CONSTRAINT `FK1_courses` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`), CONSTRAINT `FK2_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Dumping data for table xlearning.course_user: ~0 rows (approximately) /*!40000 ALTER TABLE `course_user` DISABLE KEYS */; /*!40000 ALTER TABLE `course_user` ENABLE KEYS */; -- Dumping structure for table xlearning.lessions DROP TABLE IF EXISTS `lessions`; CREATE TABLE IF NOT EXISTS `lessions` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `course_id` int(10) unsigned NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `details` text COLLATE utf8mb4_unicode_ci, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `lessions_course_id_foreign` (`course_id`), CONSTRAINT `lessions_course_id_foreign` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.lessions: ~0 rows (approximately) /*!40000 ALTER TABLE `lessions` DISABLE KEYS */; /*!40000 ALTER TABLE `lessions` ENABLE KEYS */; -- Dumping structure for table xlearning.migrations DROP TABLE IF EXISTS `migrations`; CREATE TABLE IF NOT EXISTS `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.migrations: ~9 rows (approximately) /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; REPLACE INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2017_12_25_024000_create_teachers_table', 1), (4, '2017_12_25_024259_create_courses_table', 1), (5, '2017_12_27_024359_create_lessions_table', 1), (6, '2017_12_27_024459_create_coupons_table', 1), (7, '2017_12_27_084134_create_orders_table', 1), (8, '2017_12_27_155807_create_wishlists_table', 1), (9, '2017_12_27_204144_create_orders_details_table', 1), (10, '2017_12_28_150609_alter_users_table_nullable_birthday_col', 2); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; -- Dumping structure for table xlearning.orders DROP TABLE IF EXISTS `orders`; CREATE TABLE IF NOT EXISTS `orders` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(10) unsigned NOT NULL, `coupon` int(10) unsigned DEFAULT NULL, `coupon_amount` double(8,2) unsigned DEFAULT NULL, `purchase_date` datetime DEFAULT NULL, `amount` double(8,2) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `orders_user_id_foreign` (`user_id`), KEY `orders_coupon_foreign` (`coupon`), CONSTRAINT `orders_coupon_foreign` FOREIGN KEY (`coupon`) REFERENCES `coupons` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.orders: ~0 rows (approximately) /*!40000 ALTER TABLE `orders` DISABLE KEYS */; /*!40000 ALTER TABLE `orders` ENABLE KEYS */; -- Dumping structure for table xlearning.order_details DROP TABLE IF EXISTS `order_details`; CREATE TABLE IF NOT EXISTS `order_details` ( `order_id` int(10) unsigned NOT NULL, `course_id` int(10) unsigned NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`order_id`,`course_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.order_details: ~0 rows (approximately) /*!40000 ALTER TABLE `order_details` DISABLE KEYS */; /*!40000 ALTER TABLE `order_details` ENABLE KEYS */; -- Dumping structure for table xlearning.password_resets DROP TABLE IF EXISTS `password_resets`; CREATE TABLE IF NOT EXISTS `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.password_resets: ~0 rows (approximately) /*!40000 ALTER TABLE `password_resets` DISABLE KEYS */; REPLACE INTO `password_resets` (`email`, `token`, `created_at`) VALUES ('dangdungcntt@gmail.com', '$2y$10$/YfhoaAlGhcyXb5XaPu27eNpO3LxZpPimAnA1IrnqiSEWPBk0qTKe', '2018-01-21 15:00:41'); /*!40000 ALTER TABLE `password_resets` ENABLE KEYS */; -- Dumping structure for table xlearning.teachers DROP TABLE IF EXISTS `teachers`; CREATE TABLE IF NOT EXISTS `teachers` ( `id` int(10) unsigned NOT NULL, `job` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `degree` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `experience` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, KEY `teachers_id_foreign` (`id`), CONSTRAINT `teachers_id_foreign` FOREIGN KEY (`id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.teachers: ~0 rows (approximately) /*!40000 ALTER TABLE `teachers` DISABLE KEYS */; /*!40000 ALTER TABLE `teachers` ENABLE KEYS */; -- Dumping structure for table xlearning.users DROP TABLE IF EXISTS `users`; CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `info` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `permission` int(11) NOT NULL DEFAULT '0', `socials` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `birthday` date DEFAULT NULL, `gender` tinyint(1) DEFAULT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `is_teacher` bit(1) DEFAULT b'0', PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.users: ~2 rows (approximately) /*!40000 ALTER TABLE `users` DISABLE KEYS */; REPLACE INTO `users` (`id`, `name`, `email`, `password`, `phone`, `address`, `info`, `permission`, `socials`, `image`, `birthday`, `gender`, `remember_token`, `created_at`, `updated_at`, `is_teacher`) VALUES (1, 'Nguyễn Đăng Dũng', 'dangdungcntt@gmail.com', '$2y$10$MqGfqTMQrcv0wtnfg1btA.FLf7WOSOZW41ZVanWiwgZY0IeUQY6oy', NULL, NULL, NULL, 100, NULL, NULL, NULL, NULL, 'ulNcE4XFbhDQrFldiDM0DTv7AFaZfopMlM9oMthCESdc7kwjoyIqtsgkAmqL', '2017-12-28 22:02:26', '2018-01-21 14:54:16', b'0'), (2, 'Guest', 'guest@guest.vn', '$2y$10$9ASUWZTN8Y18w1M75ulqh.3bt.LUSGbq0xomVUKvNeYzx9xeLZD.S', NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 'KsrkIOw7THXAUPpW4DD0xKbx4TualPsRTWoIrTykNOHVAiJ9Q92x0bKVAlFa', '2018-01-08 07:28:56', '2018-01-08 07:28:56', b'0'); /*!40000 ALTER TABLE `users` ENABLE KEYS */; -- Dumping structure for table xlearning.wishs_list DROP TABLE IF EXISTS `wishs_list`; CREATE TABLE IF NOT EXISTS `wishs_list` ( `user_id` int(10) unsigned NOT NULL, `course_id` int(10) unsigned NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`user_id`,`course_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table xlearning.wishs_list: ~0 rows (approximately) /*!40000 ALTER TABLE `wishs_list` DISABLE KEYS */; /*!40000 ALTER TABLE `wishs_list` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;