api de gestion de ticket, basé sur php-crud-api. Le but est de décorrélé les outils de gestion des données, afin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

blog_mysql.sql 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. -- Adminer 4.1.0 MySQL dump
  2. SET NAMES utf8;
  3. SET time_zone = '+00:00';
  4. SET foreign_key_checks = 0;
  5. SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
  6. DROP TABLE IF EXISTS `categories`;
  7. CREATE TABLE `categories` (
  8. `id` int(11) NOT NULL AUTO_INCREMENT,
  9. `name` varchar(255) NOT NULL,
  10. `icon` blob NULL,
  11. PRIMARY KEY (`id`)
  12. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  13. INSERT INTO `categories` (`id`, `name`, `icon`) VALUES
  14. (1, 'anouncement', NULL),
  15. (2, 'article', NULL);
  16. DROP TABLE IF EXISTS `comments`;
  17. CREATE TABLE `comments` (
  18. `id` int(11) NOT NULL AUTO_INCREMENT,
  19. `post_id` int(11) NOT NULL,
  20. `message` varchar(255) COLLATE utf8_general_ci NOT NULL,
  21. PRIMARY KEY (`id`),
  22. KEY `post_id` (`post_id`),
  23. CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`)
  24. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
  25. INSERT INTO `comments` (`id`, `post_id`, `message`) VALUES
  26. (1, 1, 'great'),
  27. (2, 1, 'fantastic'),
  28. (3, 2, 'thank you'),
  29. (4, 2, 'awesome');
  30. DROP TABLE IF EXISTS `posts`;
  31. CREATE TABLE `posts` (
  32. `id` int(11) NOT NULL AUTO_INCREMENT,
  33. `user_id` int(11) NOT NULL,
  34. `category_id` int(11) NOT NULL,
  35. `content` varchar(255) COLLATE utf8_general_ci NOT NULL,
  36. PRIMARY KEY (`id`),
  37. KEY `category_id` (`category_id`),
  38. KEY `user_id` (`user_id`),
  39. CONSTRAINT `posts_ibfk_3` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
  40. CONSTRAINT `posts_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
  41. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
  42. INSERT INTO `posts` (`id`, `user_id`, `category_id`, `content`) VALUES
  43. (1, 1, 1, 'blog started'),
  44. (2, 1, 2, 'It works!');
  45. DROP TABLE IF EXISTS `post_tags`;
  46. CREATE TABLE `post_tags` (
  47. `id` int(11) NOT NULL AUTO_INCREMENT,
  48. `post_id` int(11) NOT NULL,
  49. `tag_id` int(11) NOT NULL,
  50. PRIMARY KEY (`id`),
  51. KEY `post_id` (`post_id`),
  52. KEY `tag_id` (`tag_id`),
  53. CONSTRAINT `post_tags_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
  54. CONSTRAINT `post_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`)
  55. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
  56. INSERT INTO `post_tags` (`id`, `post_id`, `tag_id`) VALUES
  57. (1, 1, 1),
  58. (2, 1, 2),
  59. (3, 2, 1),
  60. (4, 2, 2);
  61. DROP TABLE IF EXISTS `tags`;
  62. CREATE TABLE `tags` (
  63. `id` int(11) NOT NULL AUTO_INCREMENT,
  64. `name` varchar(255) COLLATE utf8_general_ci NOT NULL,
  65. PRIMARY KEY (`id`)
  66. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
  67. INSERT INTO `tags` (`id`, `name`) VALUES
  68. (1, 'funny'),
  69. (2, 'important');
  70. DROP TABLE IF EXISTS `users`;
  71. CREATE TABLE `users` (
  72. `id` int(11) NOT NULL AUTO_INCREMENT,
  73. `username` varchar(255) COLLATE utf8_general_ci NOT NULL,
  74. `password` varchar(255) COLLATE utf8_general_ci NOT NULL,
  75. PRIMARY KEY (`id`)
  76. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
  77. INSERT INTO `users` (`id`, `username`, `password`) VALUES
  78. (1, 'user1', 'pass1'),
  79. (2, 'user2', 'pass2');
  80. -- 2015-02-14 17:55:38