Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2012
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 4.32 KB | None | 0 0
  1. -- phpMyAdmin SQL Dump
  2. -- version 3.5.1
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- Host: localhost
  6. -- Generation Time: Sep 22, 2012 at 09:06 PM
  7. -- Server version: 5.5.24-log
  8. -- PHP Version: 5.3.13
  9.  
  10. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  11. SET time_zone = "+00:00";
  12.  
  13. --
  14. -- Database: `dbtest`
  15. --
  16.  
  17. -- --------------------------------------------------------
  18.  
  19. --
  20. -- Table structure for table `tbl_answer`
  21. --
  22.  
  23. CREATE TABLE IF NOT EXISTS `tbl_answer` (
  24.   `question_id` INT(11) DEFAULT NULL,
  25.   `answer` longtext,
  26.   `brainded` INT(11) DEFAULT NULL,
  27.   `create_user_id` INT(11) NOT NULL,
  28.   `create_time` datetime NOT NULL,
  29.   `update_time` datetime DEFAULT NULL,
  30.   KEY `fk_tbl_answer_tbl_question` (`question_id`)
  31. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  32.  
  33. -- --------------------------------------------------------
  34.  
  35. --
  36. -- Table structure for table `tbl_profile`
  37. --
  38.  
  39. CREATE TABLE IF NOT EXISTS `tbl_profile` (
  40.   `user_id` INT(11) NOT NULL,
  41.   `first_name` VARCHAR(80) DEFAULT NULL,
  42.   `last_name` VARCHAR(80) DEFAULT NULL,
  43.   `birthday` TIMESTAMP NULL DEFAULT NULL,
  44.   `description` text,
  45.   `fb_educationJson` longtext,
  46.   `fb_workJson` longtext,
  47.   `picture` VARCHAR(256) DEFAULT NULL,
  48.   `sex` tinyint(1) DEFAULT NULL,
  49.   `city` VARCHAR(80) DEFAULT NULL,
  50.   `country` VARCHAR(80) DEFAULT NULL,
  51.   `language` VARCHAR(80) DEFAULT NULL,
  52.   `time_online` INT(11) DEFAULT NULL,
  53.   `create_time` TIMESTAMP NULL DEFAULT NULL,
  54.   `update_time` TIMESTAMP NULL DEFAULT NULL,
  55.   `fb_updated_time` TIMESTAMP NULL DEFAULT NULL,
  56.   `fb_verified` tinyint(1) DEFAULT NULL,
  57.   PRIMARY KEY (`user_id`),
  58.   KEY `fk_tbl_profile_tbl_user` (`user_id`)
  59. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  60.  
  61. -- --------------------------------------------------------
  62.  
  63. --
  64. -- Table structure for table `tbl_question`
  65. --
  66.  
  67. CREATE TABLE IF NOT EXISTS `tbl_question` (
  68.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  69.   `title` VARCHAR(128) NOT NULL,
  70.   `type` INT(11) NOT NULL,
  71.   `choice_answer` longtext NOT NULL,
  72.   `description` longtext,
  73.   `tag` text,
  74.   `best_answer_id` INT(11) DEFAULT NULL,
  75.   `create_user_id` INT(11) DEFAULT NULL,
  76.   `create_time` datetime DEFAULT NULL,
  77.   `update_time` datetime DEFAULT NULL,
  78.   PRIMARY KEY (`id`),
  79.   KEY `fk_tbl_question_tbl_user` (`create_user_id`)
  80. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  81.  
  82. -- --------------------------------------------------------
  83.  
  84. --
  85. -- Table structure for table `tbl_question_stats`
  86. --
  87.  
  88. CREATE TABLE IF NOT EXISTS `tbl_question_stats` (
  89.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  90.   `question_id` INT(11) NOT NULL,
  91.   `user_id` INT(11) DEFAULT NULL,
  92.   `user_ip` VARCHAR(30) DEFAULT NULL,
  93.   `view_referrer` VARCHAR(255) DEFAULT NULL,
  94.   `view_date` datetime DEFAULT NULL,
  95.   `time_in` INT(11) DEFAULT NULL,
  96.   PRIMARY KEY (`id`),
  97.   KEY `fk_tbl_question_stats_tbl_question` (`question_id`)
  98. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  99.  
  100. -- --------------------------------------------------------
  101.  
  102. --
  103. -- Table structure for table `tbl_user`
  104. --
  105.  
  106. CREATE TABLE IF NOT EXISTS `tbl_user` (
  107.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  108.   `fbId` INT(11) NOT NULL,
  109.   `email` VARCHAR(256) DEFAULT NULL,
  110.   `username` VARCHAR(45) DEFAULT NULL,
  111.   `password` VARCHAR(256) DEFAULT NULL,
  112.   `last_login_time` datetime DEFAULT NULL,
  113.   `create_time` datetime DEFAULT NULL,
  114.   `create_user_id` INT(11) DEFAULT NULL,
  115.   `update_time` datetime DEFAULT NULL,
  116.   `update_user_id` INT(11) DEFAULT NULL,
  117.   PRIMARY KEY (`id`)
  118. ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;
  119.  
  120. --
  121. -- Constraints for dumped tables
  122. --
  123.  
  124. --
  125. -- Constraints for table `tbl_answer`
  126. --
  127. ALTER TABLE `tbl_answer`
  128.   ADD CONSTRAINT `fk_tbl_answer_tbl_question` FOREIGN KEY (`question_id`) REFERENCES `tbl_question` (`id`) ON DELETE CASCADE;
  129.  
  130. --
  131. -- Constraints for table `tbl_profile`
  132. --
  133. ALTER TABLE `tbl_profile`
  134.   ADD CONSTRAINT `fk_tbl_profile_tbl_user` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE;
  135.  
  136. --
  137. -- Constraints for table `tbl_question`
  138. --
  139. ALTER TABLE `tbl_question`
  140.   ADD CONSTRAINT `fk_tbl_question_tbl_user` FOREIGN KEY (`create_user_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE;
  141.  
  142. --
  143. -- Constraints for table `tbl_question_stats`
  144. --
  145. ALTER TABLE `tbl_question_stats`
  146.   ADD CONSTRAINT `fk_tbl_question_stats_tbl_question` FOREIGN KEY (`question_id`) REFERENCES `tbl_question` (`id`) ON DELETE CASCADE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement