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 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. -- Adminer 4.2.4 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=utf8mb4 COLLATE=utf8mb4_general_ci;
  13. INSERT INTO `categories` (`id`, `name`, `icon`) VALUES
  14. (1, 'announcement', 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) 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=utf8mb4 COLLATE=utf8mb4_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) 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=utf8mb4 COLLATE=utf8mb4_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=utf8mb4 COLLATE=utf8mb4_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) NOT NULL,
  65. PRIMARY KEY (`id`)
  66. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_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) NOT NULL,
  74. `password` varchar(255) NOT NULL,
  75. `location` point NULL,
  76. PRIMARY KEY (`id`)
  77. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  78. INSERT INTO `users` (`id`, `username`, `password`, `location`) VALUES
  79. (1, 'user1', 'pass1', null),
  80. (2, 'user2', 'pass2', null);
  81. DROP TABLE IF EXISTS `countries`;
  82. CREATE TABLE `countries` (
  83. `id` int(11) NOT NULL AUTO_INCREMENT,
  84. `name` varchar(255) NOT NULL,
  85. `shape` polygon NOT NULL,
  86. PRIMARY KEY (`id`)
  87. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  88. INSERT INTO `countries` (`id`, `name`, `shape`) VALUES
  89. (1, 'Left', ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
  90. (2, 'Right', ST_GeomFromText('POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))'));
  91. DROP TABLE IF EXISTS `events`;
  92. CREATE TABLE `events` (
  93. `id` int(11) NOT NULL AUTO_INCREMENT,
  94. `name` varchar(255) NOT NULL,
  95. `datetime` datetime(3) NOT NULL,
  96. PRIMARY KEY (`id`)
  97. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  98. INSERT INTO `events` (`id`, `name`, `datetime`) VALUES
  99. (1, 'Launch', '2016-01-01 13:01:01.111');
  100. DROP VIEW IF EXISTS `tag_usage`;
  101. CREATE VIEW `tag_usage` AS select `name`, count(`name`) AS `count` from `tags`, `post_tags` where `tags`.`id` = `post_tags`.`tag_id` group by `name` order by `count` desc, `name`;
  102. DROP TABLE IF EXISTS `products`;
  103. CREATE TABLE `products` (
  104. `id` int(11) NOT NULL AUTO_INCREMENT,
  105. `name` varchar(255) NOT NULL,
  106. `price` decimal(10,2) NOT NULL,
  107. PRIMARY KEY (`id`)
  108. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  109. INSERT INTO `products` (`id`, `name`, `price`) VALUES
  110. (1, 'Calculator', '23.01');
  111. -- 2016-11-05 13:11:47