Advertisement
Venciity

Untitled

May 5th, 2015
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 4.14 KB | None | 0 0
  1. CREATE DATABASE  IF NOT EXISTS `forum` /*!40100 DEFAULT CHARACTER SET utf8 */;
  2. USE `forum`;
  3. -- MySQL dump 10.13  Distrib 5.6.17, for Win32 (x86)
  4. --
  5. -- Host: localhost    Database: mvc
  6. -- ------------------------------------------------------
  7. -- Server version   5.6.21
  8.  
  9. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  10. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  11. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  12. /*!40101 SET NAMES utf8 */;
  13. /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  14. /*!40103 SET TIME_ZONE='+00:00' */;
  15. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  16. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  17. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  18. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  19.  
  20. --
  21. -- Table structure for table `users`
  22. --
  23.  
  24. DROP TABLE IF EXISTS `users`;
  25. /*!40101 SET @saved_cs_client     = @@character_set_client */;
  26. /*!40101 SET character_set_client = utf8 */;
  27. CREATE TABLE `users` (
  28.   `id` int(11) NOT NULL AUTO_INCREMENT,
  29.   `username` varchar(45) NOT NULL,
  30.   `pass_hash` varchar(60) NOT NULL,
  31.   `is_admin` bit(1) NOT NULL DEFAULT b'0',
  32.   PRIMARY KEY (`id`),
  33.   UNIQUE KEY `username_UNIQUE` (`username`)
  34. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  35. /*!40101 SET character_set_client = @saved_cs_client */;
  36.  
  37. --
  38. -- Dumping data for table `users`
  39. --
  40.  
  41. LOCK TABLES `users` WRITE;
  42. /*!40000 ALTER TABLE `users` DISABLE KEYS */;
  43. /*!40000 ALTER TABLE `users` ENABLE KEYS */;
  44. UNLOCK TABLES;
  45. /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  46.  
  47. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  48. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  49. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  50. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  51. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  52. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  53. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  54.  
  55. --
  56. -- Table structure for table `questions`
  57. --
  58.  
  59. DROP TABLE IF EXISTS `questions`;
  60. /*!40101 SET @saved_cs_client     = @@character_set_client */;
  61. /*!40101 SET character_set_client = utf8 */;
  62. CREATE TABLE `questions` (
  63.   `id` int(11) NOT NULL AUTO_INCREMENT,
  64.   `text` varchar(300) NOT NULL,
  65.   `user_id` int(11) DEFAULT NULL,
  66.   `category_id` int(11) DEFAULT NULL,
  67.   PRIMARY KEY (`id`),
  68.   KEY `fk_users_questions_idx` (`user_id`),
  69.   CONSTRAINT `fk_users_questions` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  70.   KEY `fk_categories_questions_idx` (`category_id`),
  71.   CONSTRAINT `fk_categories_questions` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  72. ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
  73. /*!40101 SET character_set_client = @saved_cs_client */;
  74.  
  75. --
  76. -- Dumping data for table `authors`
  77. --
  78.  
  79. LOCK TABLES `authors` WRITE;
  80. /*!40000 ALTER TABLE `authors` DISABLE KEYS */;
  81. INSERT INTO `authors` VALUES (1,'Pesho'),(2,'Kiro'),(3,'Maria'),(6,'Nakov');
  82. /*!40000 ALTER TABLE `authors` ENABLE KEYS */;
  83. UNLOCK TABLES;
  84.  
  85. --
  86. -- Table structure for table `books`
  87. --
  88.  
  89. DROP TABLE IF EXISTS `books`;
  90. /*!40101 SET @saved_cs_client     = @@character_set_client */;
  91. /*!40101 SET character_set_client = utf8 */;
  92. CREATE TABLE `books` (
  93.   `id` int(11) NOT NULL AUTO_INCREMENT,
  94.   `title` varchar(200) NOT NULL,
  95.   `isbn` varchar(20) DEFAULT NULL,
  96.   `url` varchar(200) DEFAULT NULL,
  97.   `author_id` int(11) DEFAULT NULL,
  98.   PRIMARY KEY (`id`),
  99.   KEY `fk_books_authors_idx` (`author_id`),
  100.   CONSTRAINT `fk_books_authors` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  101. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
  102. /*!40101 SET character_set_client = @saved_cs_client */;
  103.  
  104. --
  105. -- Dumping data for table `books`
  106. --
  107.  
  108. LOCK TABLES `books` WRITE;
  109. /*!40000 ALTER TABLE `books` DISABLE KEYS */;
  110. INSERT INTO `books` VALUES (1,'PHP for Dummies',NULL,NULL,NULL),(2,'PHP for Beginners','123-456-789',NULL,1),(3,'PHP Quick Start',NULL,'http://php.net',2);
  111. /*!40000 ALTER TABLE `books` ENABLE KEYS */;
  112. UNLOCK TABLES;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement