/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

  1. -- MySQL dump 10.13 Distrib 5.6.22, for osx10.8 (x86_64)
  2. --
  3. -- Host: 127.0.0.1 Database: openmentor
  4. -- ------------------------------------------------------
  5. -- Server version 5.5.16
  6. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  7. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  8. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  9. /*!40101 SET NAMES utf8 */;
  10. /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  11. /*!40103 SET TIME_ZONE='+00:00' */;
  12. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  13. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  14. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  15. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  16. --
  17. -- Table structure for table `grade`
  18. --
  19. DROP TABLE IF EXISTS `grade`;
  20. /*!40101 SET @saved_cs_client = @@character_set_client */;
  21. /*!40101 SET character_set_client = utf8 */;
  22. CREATE TABLE `grade` (
  23. `grade` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
  24. `version` bigint(20) NOT NULL,
  25. PRIMARY KEY (`grade`)
  26. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  27. /*!40101 SET character_set_client = @saved_cs_client */;
  28. --
  29. -- Table structure for table `category`
  30. --
  31. DROP TABLE IF EXISTS `category`;
  32. /*!40101 SET @saved_cs_client = @@character_set_client */;
  33. /*!40101 SET character_set_client = utf8 */;
  34. CREATE TABLE `category` (
  35. `category` varchar(8) COLLATE utf8_unicode_ci NOT NULL,
  36. `version` bigint(20) NOT NULL,
  37. `band` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  38. PRIMARY KEY (`category`),
  39. KEY `band_index` (`band`)
  40. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  41. /*!40101 SET character_set_client = @saved_cs_client */;
  42. --
  43. -- Table structure for table `weight`
  44. --
  45. DROP TABLE IF EXISTS `weight`;
  46. /*!40101 SET @saved_cs_client = @@character_set_client */;
  47. /*!40101 SET character_set_client = utf8 */;
  48. CREATE TABLE `weight` (
  49. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  50. `version` bigint(20) NOT NULL,
  51. `band` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  52. `grade` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
  53. `weight` float NOT NULL,
  54. PRIMARY KEY (`id`),
  55. KEY `FKD0D14278B8341403` (`grade`),
  56. KEY `band_grade_index` (`band`,`grade`),
  57. CONSTRAINT `FKD0D14278B8341403` FOREIGN KEY (`grade`) REFERENCES `grade` (`grade`)
  58. ) ENGINE=InnoDB AUTO_INCREMENT=2911 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  59. /*!40101 SET character_set_client = @saved_cs_client */;
  60. --
  61. -- Table structure for table `assignment`
  62. --
  63. DROP TABLE IF EXISTS `assignment`;
  64. /*!40101 SET @saved_cs_client = @@character_set_client */;
  65. /*!40101 SET character_set_client = utf8 */;
  66. CREATE TABLE `assignment` (
  67. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  68. `version` bigint(20) NOT NULL,
  69. `code` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  70. `course_id` bigint(20) NOT NULL,
  71. `owner` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  72. `title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  73. PRIMARY KEY (`id`),
  74. KEY `FK3D2B86CDF6F414BE` (`course_id`),
  75. CONSTRAINT `FK3D2B86CDF6F414BE` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`)
  76. ) ENGINE=InnoDB AUTO_INCREMENT=352 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  77. /*!40101 SET character_set_client = @saved_cs_client */;
  78. --
  79. -- Table structure for table `comment`
  80. --
  81. DROP TABLE IF EXISTS `comment`;
  82. /*!40101 SET @saved_cs_client = @@character_set_client */;
  83. /*!40101 SET character_set_client = utf8 */;
  84. CREATE TABLE `comment` (
  85. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  86. `version` bigint(20) NOT NULL,
  87. `submission_id` bigint(20) NOT NULL,
  88. `text` varchar(4096) COLLATE utf8_unicode_ci NOT NULL,
  89. PRIMARY KEY (`id`),
  90. KEY `FK38A5EE5FB5AFCD5D` (`submission_id`),
  91. CONSTRAINT `FK38A5EE5FB5AFCD5D` FOREIGN KEY (`submission_id`) REFERENCES `submission` (`id`)
  92. ) ENGINE=InnoDB AUTO_INCREMENT=10881 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  93. /*!40101 SET character_set_client = @saved_cs_client */;
  94. --
  95. -- Table structure for table `comment_category`
  96. --
  97. DROP TABLE IF EXISTS `comment_category`;
  98. /*!40101 SET @saved_cs_client = @@character_set_client */;
  99. /*!40101 SET character_set_client = utf8 */;
  100. CREATE TABLE `comment_category` (
  101. `comment_categories_id` bigint(20) DEFAULT NULL,
  102. `category_id` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  103. KEY `FKA7CEBADE4866F885` (`category_id`),
  104. KEY `FKA7CEBADE4D411E5A` (`comment_categories_id`),
  105. CONSTRAINT `FKA7CEBADE4866F885` FOREIGN KEY (`category_id`) REFERENCES `category` (`category`),
  106. CONSTRAINT `FKA7CEBADE4D411E5A` FOREIGN KEY (`comment_categories_id`) REFERENCES `comment` (`id`)
  107. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  108. /*!40101 SET character_set_client = @saved_cs_client */;
  109. --
  110. -- Table structure for table `course`
  111. --
  112. DROP TABLE IF EXISTS `course`;
  113. /*!40101 SET @saved_cs_client = @@character_set_client */;
  114. /*!40101 SET character_set_client = utf8 */;
  115. CREATE TABLE `course` (
  116. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  117. `version` bigint(20) NOT NULL,
  118. `course_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  119. `course_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  120. `owner` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  121. PRIMARY KEY (`id`),
  122. UNIQUE KEY `owner` (`owner`,`course_id`)
  123. ) ENGINE=InnoDB AUTO_INCREMENT=339 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  124. /*!40101 SET character_set_client = @saved_cs_client */;
  125. --
  126. -- Table structure for table `role`
  127. --
  128. DROP TABLE IF EXISTS `role`;
  129. /*!40101 SET @saved_cs_client = @@character_set_client */;
  130. /*!40101 SET character_set_client = utf8 */;
  131. CREATE TABLE `role` (
  132. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  133. `version` bigint(20) NOT NULL,
  134. `authority` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  135. PRIMARY KEY (`id`),
  136. UNIQUE KEY `authority` (`authority`)
  137. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  138. /*!40101 SET character_set_client = @saved_cs_client */;
  139. --
  140. -- Table structure for table `student`
  141. --
  142. DROP TABLE IF EXISTS `student`;
  143. /*!40101 SET @saved_cs_client = @@character_set_client */;
  144. /*!40101 SET character_set_client = utf8 */;
  145. CREATE TABLE `student` (
  146. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  147. `version` bigint(20) NOT NULL,
  148. `family_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  149. `given_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  150. `owner` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  151. `student_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  152. PRIMARY KEY (`id`),
  153. UNIQUE KEY `owner` (`owner`,`student_id`)
  154. ) ENGINE=InnoDB AUTO_INCREMENT=721 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  155. /*!40101 SET character_set_client = @saved_cs_client */;
  156. --
  157. -- Table structure for table `student_courses`
  158. --
  159. DROP TABLE IF EXISTS `student_courses`;
  160. /*!40101 SET @saved_cs_client = @@character_set_client */;
  161. /*!40101 SET character_set_client = utf8 */;
  162. CREATE TABLE `student_courses` (
  163. `course_id` bigint(20) NOT NULL,
  164. `student_id` bigint(20) NOT NULL,
  165. PRIMARY KEY (`student_id`,`course_id`),
  166. KEY `FK63CAE1B46C6E4376` (`student_id`),
  167. KEY `FK63CAE1B4F6F414BE` (`course_id`),
  168. CONSTRAINT `FK63CAE1B46C6E4376` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`),
  169. CONSTRAINT `FK63CAE1B4F6F414BE` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`)
  170. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  171. /*!40101 SET character_set_client = @saved_cs_client */;
  172. --
  173. -- Table structure for table `submission`
  174. --
  175. DROP TABLE IF EXISTS `submission`;
  176. /*!40101 SET @saved_cs_client = @@character_set_client */;
  177. /*!40101 SET character_set_client = utf8 */;
  178. CREATE TABLE `submission` (
  179. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  180. `version` bigint(20) NOT NULL,
  181. `assignment_id` bigint(20) NOT NULL,
  182. `date_submitted` datetime NOT NULL,
  183. `file_contents` longblob,
  184. `filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  185. `grade_id` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
  186. `long_filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  187. `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  188. PRIMARY KEY (`id`),
  189. KEY `FK84363B4CB7A962AF` (`grade_id`),
  190. KEY `FK84363B4C3DBA2D7E` (`assignment_id`),
  191. CONSTRAINT `FK84363B4C3DBA2D7E` FOREIGN KEY (`assignment_id`) REFERENCES `assignment` (`id`),
  192. CONSTRAINT `FK84363B4CB7A962AF` FOREIGN KEY (`grade_id`) REFERENCES `grade` (`grade`)
  193. ) ENGINE=InnoDB AUTO_INCREMENT=708 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  194. /*!40101 SET character_set_client = @saved_cs_client */;
  195. --
  196. -- Table structure for table `submission_student_ids`
  197. --
  198. DROP TABLE IF EXISTS `submission_student_ids`;
  199. /*!40101 SET @saved_cs_client = @@character_set_client */;
  200. /*!40101 SET character_set_client = utf8 */;
  201. CREATE TABLE `submission_student_ids` (
  202. `submission_id` bigint(20) DEFAULT NULL,
  203. `student_ids_string` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  204. KEY `FK4BE1BA41B5AFCD5D` (`submission_id`),
  205. CONSTRAINT `FK4BE1BA41B5AFCD5D` FOREIGN KEY (`submission_id`) REFERENCES `submission` (`id`)
  206. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  207. /*!40101 SET character_set_client = @saved_cs_client */;
  208. --
  209. -- Table structure for table `submission_tutor_ids`
  210. --
  211. DROP TABLE IF EXISTS `submission_tutor_ids`;
  212. /*!40101 SET @saved_cs_client = @@character_set_client */;
  213. /*!40101 SET character_set_client = utf8 */;
  214. CREATE TABLE `submission_tutor_ids` (
  215. `submission_id` bigint(20) DEFAULT NULL,
  216. `tutor_ids_string` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  217. KEY `FK2E2A58FCB5AFCD5D` (`submission_id`),
  218. CONSTRAINT `FK2E2A58FCB5AFCD5D` FOREIGN KEY (`submission_id`) REFERENCES `submission` (`id`)
  219. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  220. /*!40101 SET character_set_client = @saved_cs_client */;
  221. --
  222. -- Table structure for table `tutor`
  223. --
  224. DROP TABLE IF EXISTS `tutor`;
  225. /*!40101 SET @saved_cs_client = @@character_set_client */;
  226. /*!40101 SET character_set_client = utf8 */;
  227. CREATE TABLE `tutor` (
  228. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  229. `version` bigint(20) NOT NULL,
  230. `family_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  231. `given_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  232. `owner` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  233. `tutor_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  234. PRIMARY KEY (`id`),
  235. UNIQUE KEY `owner` (`owner`,`tutor_id`)
  236. ) ENGINE=InnoDB AUTO_INCREMENT=278 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  237. /*!40101 SET character_set_client = @saved_cs_client */;
  238. --
  239. -- Table structure for table `tutor_courses`
  240. --
  241. DROP TABLE IF EXISTS `tutor_courses`;
  242. /*!40101 SET @saved_cs_client = @@character_set_client */;
  243. /*!40101 SET character_set_client = utf8 */;
  244. CREATE TABLE `tutor_courses` (
  245. `tutor_id` bigint(20) NOT NULL,
  246. `course_id` bigint(20) NOT NULL,
  247. PRIMARY KEY (`tutor_id`,`course_id`),
  248. KEY `FKC72ACBAF95B1496` (`tutor_id`),
  249. KEY `FKC72ACBAFF6F414BE` (`course_id`),
  250. CONSTRAINT `FKC72ACBAF95B1496` FOREIGN KEY (`tutor_id`) REFERENCES `tutor` (`id`),
  251. CONSTRAINT `FKC72ACBAFF6F414BE` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`)
  252. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  253. /*!40101 SET character_set_client = @saved_cs_client */;
  254. --
  255. -- Table structure for table `user`
  256. --
  257. DROP TABLE IF EXISTS `user`;
  258. /*!40101 SET @saved_cs_client = @@character_set_client */;
  259. /*!40101 SET character_set_client = utf8 */;
  260. CREATE TABLE `user` (
  261. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  262. `version` bigint(20) NOT NULL,
  263. `account_expired` bit(1) NOT NULL,
  264. `account_locked` bit(1) NOT NULL,
  265. `confirm` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  266. `enabled` bit(1) NOT NULL,
  267. `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  268. `password_expired` bit(1) NOT NULL,
  269. `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  270. PRIMARY KEY (`id`),
  271. UNIQUE KEY `username` (`username`)
  272. ) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  273. /*!40101 SET character_set_client = @saved_cs_client */;
  274. --
  275. -- Table structure for table `user_role`
  276. --
  277. DROP TABLE IF EXISTS `user_role`;
  278. /*!40101 SET @saved_cs_client = @@character_set_client */;
  279. /*!40101 SET character_set_client = utf8 */;
  280. CREATE TABLE `user_role` (
  281. `role_id` bigint(20) NOT NULL,
  282. `user_id` bigint(20) NOT NULL,
  283. PRIMARY KEY (`role_id`,`user_id`),
  284. KEY `FK143BF46AD9ABBC1F` (`role_id`),
  285. KEY `FK143BF46A7ED67FFF` (`user_id`),
  286. CONSTRAINT `FK143BF46A7ED67FFF` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
  287. CONSTRAINT `FK143BF46AD9ABBC1F` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
  288. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  289. /*!40101 SET character_set_client = @saved_cs_client */;
  290. --
  291. -- Table structure for table `weight`
  292. --
  293. DROP TABLE IF EXISTS `weight`;
  294. /*!40101 SET @saved_cs_client = @@character_set_client */;
  295. /*!40101 SET character_set_client = utf8 */;
  296. CREATE TABLE `weight` (
  297. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  298. `version` bigint(20) NOT NULL,
  299. `band` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  300. `grade` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
  301. `weight` float NOT NULL,
  302. PRIMARY KEY (`id`),
  303. KEY `FKD0D14278B8341403` (`grade`),
  304. KEY `band_grade_index` (`band`,`grade`),
  305. CONSTRAINT `FKD0D14278B8341403` FOREIGN KEY (`grade`) REFERENCES `grade` (`grade`)
  306. ) ENGINE=InnoDB AUTO_INCREMENT=2959 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  307. /*!40101 SET character_set_client = @saved_cs_client */;
  308. /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  309. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  310. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  311. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  312. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  313. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  314. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  315. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  316. -- Dump completed on 2015-12-28 16:37:24