install.sql 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. -- phpMyAdmin SQL Dump
  2. -- version 4.0.4.1
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- Host: 127.0.0.1
  6. -- Generation Time: Oct 06, 2013 at 10:22 PM
  7. -- Server version: 5.6.11
  8. -- PHP Version: 5.5.3
  9. SET FOREIGN_KEY_CHECKS=0;
  10. SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  11. SET time_zone = "+00:00";
  12. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  13. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  14. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  15. /*!40101 SET NAMES utf8 */;
  16. -- --------------------------------------------------------
  17. --
  18. -- Table structure for table `issues`
  19. --
  20. -- Creation: Oct 06, 2013 at 08:17 PM
  21. --
  22. DROP TABLE IF EXISTS `issues`;
  23. CREATE TABLE IF NOT EXISTS `issues` (
  24. `id` int(100) NOT NULL AUTO_INCREMENT,
  25. `u_id` int(100) NOT NULL,
  26. `s_id` int(100) DEFAULT NULL,
  27. `title` varchar(100) NOT NULL,
  28. `description` text NOT NULL,
  29. PRIMARY KEY (`id`),
  30. KEY `u_id` (`u_id`),
  31. KEY `u_id_2` (`u_id`),
  32. KEY `s_id` (`s_id`)
  33. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
  34. --
  35. -- RELATIONS FOR TABLE `issues`:
  36. -- `s_id`
  37. -- `scrums` -> `id`
  38. -- `u_id`
  39. -- `users` -> `id`
  40. --
  41. -- --------------------------------------------------------
  42. --
  43. -- Table structure for table `messages`
  44. --
  45. -- Creation: Oct 06, 2013 at 08:21 PM
  46. --
  47. DROP TABLE IF EXISTS `messages`;
  48. CREATE TABLE IF NOT EXISTS `messages` (
  49. `id` int(100) NOT NULL AUTO_INCREMENT,
  50. `from_id` int(100) NOT NULL,
  51. `to_id` int(100) DEFAULT NULL,
  52. `s_id` int(100) DEFAULT NULL,
  53. `i_id` int(100) DEFAULT NULL,
  54. `message` text NOT NULL,
  55. PRIMARY KEY (`id`),
  56. KEY `from_id` (`from_id`,`to_id`,`s_id`,`i_id`),
  57. KEY `to_id` (`to_id`),
  58. KEY `s_id` (`s_id`),
  59. KEY `i_id` (`i_id`)
  60. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
  61. --
  62. -- RELATIONS FOR TABLE `messages`:
  63. -- `i_id`
  64. -- `issues` -> `id`
  65. -- `from_id`
  66. -- `users` -> `id`
  67. -- `to_id`
  68. -- `users` -> `id`
  69. -- `s_id`
  70. -- `scrums` -> `id`
  71. --
  72. -- --------------------------------------------------------
  73. --
  74. -- Table structure for table `rels`
  75. --
  76. -- Creation: Oct 06, 2013 at 08:21 PM
  77. --
  78. DROP TABLE IF EXISTS `rels`;
  79. CREATE TABLE IF NOT EXISTS `rels` (
  80. `id` int(11) NOT NULL AUTO_INCREMENT,
  81. `u_id` int(11) NOT NULL,
  82. `i_id` int(11) DEFAULT NULL,
  83. `s_id` int(11) DEFAULT NULL,
  84. PRIMARY KEY (`id`),
  85. KEY `u_id` (`u_id`,`i_id`,`s_id`),
  86. KEY `i_id` (`i_id`),
  87. KEY `s_id` (`s_id`)
  88. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  89. --
  90. -- RELATIONS FOR TABLE `rels`:
  91. -- `s_id`
  92. -- `scrums` -> `id`
  93. -- `u_id`
  94. -- `users` -> `id`
  95. -- `i_id`
  96. -- `issues` -> `id`
  97. --
  98. -- --------------------------------------------------------
  99. --
  100. -- Table structure for table `scrums`
  101. --
  102. -- Creation: Oct 06, 2013 at 08:17 PM
  103. --
  104. DROP TABLE IF EXISTS `scrums`;
  105. CREATE TABLE IF NOT EXISTS `scrums` (
  106. `id` int(100) NOT NULL AUTO_INCREMENT,
  107. `u_id` int(100) NOT NULL,
  108. `title` varchar(100) NOT NULL,
  109. `description` text NOT NULL,
  110. PRIMARY KEY (`id`),
  111. KEY `u_id` (`u_id`)
  112. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  113. --
  114. -- RELATIONS FOR TABLE `scrums`:
  115. -- `u_id`
  116. -- `users` -> `id`
  117. --
  118. -- --------------------------------------------------------
  119. --
  120. -- Table structure for table `users`
  121. --
  122. -- Creation: Oct 06, 2013 at 08:17 PM
  123. --
  124. DROP TABLE IF EXISTS `users`;
  125. CREATE TABLE IF NOT EXISTS `users` (
  126. `id` int(11) NOT NULL AUTO_INCREMENT,
  127. `name` varchar(50) NOT NULL,
  128. `email` varchar(254) NOT NULL,
  129. `password` varchar(50) NOT NULL,
  130. `hash` varchar(50) NOT NULL,
  131. `salt` varchar(20) NOT NULL,
  132. PRIMARY KEY (`id`),
  133. UNIQUE KEY `name` (`name`)
  134. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  135. --
  136. -- Constraints for dumped tables
  137. --
  138. --
  139. -- Constraints for table `issues`
  140. --
  141. ALTER TABLE `issues`
  142. ADD CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`s_id`) REFERENCES `scrums` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  143. ADD CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`u_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  144. --
  145. -- Constraints for table `messages`
  146. --
  147. ALTER TABLE `messages`
  148. ADD CONSTRAINT `messages_ibfk_4` FOREIGN KEY (`i_id`) REFERENCES `issues` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  149. ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`from_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  150. ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`to_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE SET NULL,
  151. ADD CONSTRAINT `messages_ibfk_3` FOREIGN KEY (`s_id`) REFERENCES `scrums` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  152. --
  153. -- Constraints for table `rels`
  154. --
  155. ALTER TABLE `rels`
  156. ADD CONSTRAINT `rels_ibfk_3` FOREIGN KEY (`s_id`) REFERENCES `scrums` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  157. ADD CONSTRAINT `rels_ibfk_1` FOREIGN KEY (`u_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  158. ADD CONSTRAINT `rels_ibfk_2` FOREIGN KEY (`i_id`) REFERENCES `issues` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  159. --
  160. -- Constraints for table `scrums`
  161. --
  162. ALTER TABLE `scrums`
  163. ADD CONSTRAINT `scrums_ibfk_1` FOREIGN KEY (`u_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  164. SET FOREIGN_KEY_CHECKS=1;
  165. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  166. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  167. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;