/src/main/etc/initialize_mysql.sql
https://github.com/omtetra/openmentor-grails · SQL · 355 lines · 256 code · 39 blank · 60 comment · 0 complexity · c86f09cc92cb39780d9638b0285ed0ba MD5 · raw file
- -- MySQL dump 10.13 Distrib 5.6.22, for osx10.8 (x86_64)
- --
- -- Host: 127.0.0.1 Database: openmentor
- -- ------------------------------------------------------
- -- Server version 5.5.16
- /*!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 utf8 */;
- /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
- /*!40103 SET TIME_ZONE='+00:00' */;
- /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
- /*!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' */;
- /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
- --
- -- Table structure for table `grade`
- --
- DROP TABLE IF EXISTS `grade`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `grade` (
- `grade` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
- `version` bigint(20) NOT NULL,
- PRIMARY KEY (`grade`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `category`
- --
- DROP TABLE IF EXISTS `category`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `category` (
- `category` varchar(8) COLLATE utf8_unicode_ci NOT NULL,
- `version` bigint(20) NOT NULL,
- `band` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`category`),
- KEY `band_index` (`band`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `weight`
- --
- DROP TABLE IF EXISTS `weight`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `weight` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `band` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
- `grade` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
- `weight` float NOT NULL,
- PRIMARY KEY (`id`),
- KEY `FKD0D14278B8341403` (`grade`),
- KEY `band_grade_index` (`band`,`grade`),
- CONSTRAINT `FKD0D14278B8341403` FOREIGN KEY (`grade`) REFERENCES `grade` (`grade`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2911 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `assignment`
- --
- DROP TABLE IF EXISTS `assignment`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `assignment` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `code` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `course_id` bigint(20) NOT NULL,
- `owner` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
- `title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `FK3D2B86CDF6F414BE` (`course_id`),
- CONSTRAINT `FK3D2B86CDF6F414BE` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=352 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `comment`
- --
- DROP TABLE IF EXISTS `comment`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `comment` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `submission_id` bigint(20) NOT NULL,
- `text` varchar(4096) COLLATE utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`id`),
- KEY `FK38A5EE5FB5AFCD5D` (`submission_id`),
- CONSTRAINT `FK38A5EE5FB5AFCD5D` FOREIGN KEY (`submission_id`) REFERENCES `submission` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=10881 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `comment_category`
- --
- DROP TABLE IF EXISTS `comment_category`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `comment_category` (
- `comment_categories_id` bigint(20) DEFAULT NULL,
- `category_id` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
- KEY `FKA7CEBADE4866F885` (`category_id`),
- KEY `FKA7CEBADE4D411E5A` (`comment_categories_id`),
- CONSTRAINT `FKA7CEBADE4866F885` FOREIGN KEY (`category_id`) REFERENCES `category` (`category`),
- CONSTRAINT `FKA7CEBADE4D411E5A` FOREIGN KEY (`comment_categories_id`) REFERENCES `comment` (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `course`
- --
- DROP TABLE IF EXISTS `course`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `course` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `course_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `course_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `owner` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `owner` (`owner`,`course_id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=339 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `role`
- --
- DROP TABLE IF EXISTS `role`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `role` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `authority` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `authority` (`authority`)
- ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `student`
- --
- DROP TABLE IF EXISTS `student`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `student` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `family_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `given_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `owner` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
- `student_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `owner` (`owner`,`student_id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=721 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `student_courses`
- --
- DROP TABLE IF EXISTS `student_courses`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `student_courses` (
- `course_id` bigint(20) NOT NULL,
- `student_id` bigint(20) NOT NULL,
- PRIMARY KEY (`student_id`,`course_id`),
- KEY `FK63CAE1B46C6E4376` (`student_id`),
- KEY `FK63CAE1B4F6F414BE` (`course_id`),
- CONSTRAINT `FK63CAE1B46C6E4376` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`),
- CONSTRAINT `FK63CAE1B4F6F414BE` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `submission`
- --
- DROP TABLE IF EXISTS `submission`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `submission` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `assignment_id` bigint(20) NOT NULL,
- `date_submitted` datetime NOT NULL,
- `file_contents` longblob,
- `filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `grade_id` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
- `long_filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`id`),
- KEY `FK84363B4CB7A962AF` (`grade_id`),
- KEY `FK84363B4C3DBA2D7E` (`assignment_id`),
- CONSTRAINT `FK84363B4C3DBA2D7E` FOREIGN KEY (`assignment_id`) REFERENCES `assignment` (`id`),
- CONSTRAINT `FK84363B4CB7A962AF` FOREIGN KEY (`grade_id`) REFERENCES `grade` (`grade`)
- ) ENGINE=InnoDB AUTO_INCREMENT=708 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `submission_student_ids`
- --
- DROP TABLE IF EXISTS `submission_student_ids`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `submission_student_ids` (
- `submission_id` bigint(20) DEFAULT NULL,
- `student_ids_string` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
- KEY `FK4BE1BA41B5AFCD5D` (`submission_id`),
- CONSTRAINT `FK4BE1BA41B5AFCD5D` FOREIGN KEY (`submission_id`) REFERENCES `submission` (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `submission_tutor_ids`
- --
- DROP TABLE IF EXISTS `submission_tutor_ids`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `submission_tutor_ids` (
- `submission_id` bigint(20) DEFAULT NULL,
- `tutor_ids_string` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
- KEY `FK2E2A58FCB5AFCD5D` (`submission_id`),
- CONSTRAINT `FK2E2A58FCB5AFCD5D` FOREIGN KEY (`submission_id`) REFERENCES `submission` (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `tutor`
- --
- DROP TABLE IF EXISTS `tutor`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `tutor` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `family_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `given_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `owner` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
- `tutor_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `owner` (`owner`,`tutor_id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=278 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `tutor_courses`
- --
- DROP TABLE IF EXISTS `tutor_courses`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `tutor_courses` (
- `tutor_id` bigint(20) NOT NULL,
- `course_id` bigint(20) NOT NULL,
- PRIMARY KEY (`tutor_id`,`course_id`),
- KEY `FKC72ACBAF95B1496` (`tutor_id`),
- KEY `FKC72ACBAFF6F414BE` (`course_id`),
- CONSTRAINT `FKC72ACBAF95B1496` FOREIGN KEY (`tutor_id`) REFERENCES `tutor` (`id`),
- CONSTRAINT `FKC72ACBAFF6F414BE` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `user`
- --
- DROP TABLE IF EXISTS `user`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `user` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `account_expired` bit(1) NOT NULL,
- `account_locked` bit(1) NOT NULL,
- `confirm` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `enabled` bit(1) NOT NULL,
- `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- `password_expired` bit(1) NOT NULL,
- `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `username` (`username`)
- ) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `user_role`
- --
- DROP TABLE IF EXISTS `user_role`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `user_role` (
- `role_id` bigint(20) NOT NULL,
- `user_id` bigint(20) NOT NULL,
- PRIMARY KEY (`role_id`,`user_id`),
- KEY `FK143BF46AD9ABBC1F` (`role_id`),
- KEY `FK143BF46A7ED67FFF` (`user_id`),
- CONSTRAINT `FK143BF46A7ED67FFF` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
- CONSTRAINT `FK143BF46AD9ABBC1F` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- --
- -- Table structure for table `weight`
- --
- DROP TABLE IF EXISTS `weight`;
- /*!40101 SET @saved_cs_client = @@character_set_client */;
- /*!40101 SET character_set_client = utf8 */;
- CREATE TABLE `weight` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `version` bigint(20) NOT NULL,
- `band` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
- `grade` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
- `weight` float NOT NULL,
- PRIMARY KEY (`id`),
- KEY `FKD0D14278B8341403` (`grade`),
- KEY `band_grade_index` (`band`,`grade`),
- CONSTRAINT `FKD0D14278B8341403` FOREIGN KEY (`grade`) REFERENCES `grade` (`grade`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2959 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- /*!40101 SET character_set_client = @saved_cs_client */;
- /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
- /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
- /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
- /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
- /*!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 */;
- /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
- -- Dump completed on 2015-12-28 16:37:24