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
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

blog_mysql.sql 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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 COMMENT 'The identifier of the category.',
  9. `name` varchar(255) NOT NULL COMMENT 'The name of the category.',
  10. `icon` blob COMMENT 'A small image representing the category.',
  11. PRIMARY KEY (`id`)
  12. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='The post categories of the blog system.';
  13. INSERT INTO `categories` (`name`, `icon`) VALUES
  14. ('announcement', NULL),
  15. ('article', NULL),
  16. ('comment', NULL);
  17. DROP TABLE IF EXISTS `comments`;
  18. CREATE TABLE `comments` (
  19. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  20. `post_id` int(11) NOT NULL,
  21. `message` varchar(255) NOT NULL,
  22. `category_id` int(11) NOT NULL,
  23. PRIMARY KEY (`id`),
  24. KEY `post_id` (`post_id`),
  25. CONSTRAINT `comments_post_id_fkey` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
  26. CONSTRAINT `comments_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`)
  27. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  28. INSERT INTO `comments` (`post_id`, `message`, `category_id`) VALUES
  29. (1, 'great', 3),
  30. (1, 'fantastic', 3),
  31. (2, 'thank you', 3),
  32. (2, 'awesome', 3);
  33. DROP TABLE IF EXISTS `posts`;
  34. CREATE TABLE `posts` (
  35. `id` int(11) NOT NULL AUTO_INCREMENT,
  36. `user_id` int(11) NOT NULL,
  37. `category_id` int(11) NOT NULL,
  38. `content` varchar(255) NOT NULL,
  39. PRIMARY KEY (`id`),
  40. KEY `category_id` (`category_id`),
  41. KEY `user_id` (`user_id`),
  42. CONSTRAINT `posts_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
  43. CONSTRAINT `posts_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
  44. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  45. INSERT INTO `posts` (`user_id`, `category_id`, `content`) VALUES
  46. (1, 1, 'blog started'),
  47. (1, 2, 'It works!');
  48. DROP TABLE IF EXISTS `post_tags`;
  49. CREATE TABLE `post_tags` (
  50. `id` int(11) NOT NULL AUTO_INCREMENT,
  51. `post_id` int(11) NOT NULL,
  52. `tag_id` int(11) NOT NULL,
  53. PRIMARY KEY (`id`),
  54. KEY `post_id` (`post_id`),
  55. KEY `tag_id` (`tag_id`),
  56. CONSTRAINT `post_tags_post_id_fkey` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
  57. CONSTRAINT `post_tags_tag_id_fkey` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`)
  58. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  59. INSERT INTO `post_tags` (`post_id`, `tag_id`) VALUES
  60. (1, 1),
  61. (1, 2),
  62. (2, 1),
  63. (2, 2);
  64. DROP TABLE IF EXISTS `tags`;
  65. CREATE TABLE `tags` (
  66. `id` int(11) NOT NULL AUTO_INCREMENT,
  67. `name` varchar(255) NOT NULL,
  68. `is_important` bit(1) NOT NULL,
  69. PRIMARY KEY (`id`)
  70. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  71. INSERT INTO `tags` (`name`, `is_important`) VALUES
  72. ('funny', 0),
  73. ('important', 1);
  74. DROP TABLE IF EXISTS `users`;
  75. CREATE TABLE `users` (
  76. `id` int(11) NOT NULL AUTO_INCREMENT,
  77. `username` varchar(255) NOT NULL,
  78. `password` varchar(255) NOT NULL,
  79. `location` point,
  80. PRIMARY KEY (`id`)
  81. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  82. INSERT INTO `users` (`username`, `password`, `location`) VALUES
  83. ('user1', 'pass1', NULL),
  84. ('user2', '$2y$10$cg7/nswxVZ0cmVIsMB/pVOh1OfcHScBJGq7Xu4KF9dFEQgRZ8HWe.', NULL);
  85. DROP TABLE IF EXISTS `countries`;
  86. CREATE TABLE `countries` (
  87. `id` int(11) NOT NULL AUTO_INCREMENT,
  88. `name` varchar(255) NOT NULL,
  89. `shape` geometry NOT NULL,
  90. PRIMARY KEY (`id`)
  91. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  92. INSERT INTO `countries` (`name`, `shape`) VALUES
  93. ('Left', ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
  94. ('Right', ST_GeomFromText('POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))')),
  95. ('Point', ST_GeomFromText('POINT (30 10)')),
  96. ('Line', ST_GeomFromText('LINESTRING (30 10, 10 30, 40 40)')),
  97. ('Poly1', ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
  98. ('Poly2', ST_GeomFromText('POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))')),
  99. ('Mpoint', ST_GeomFromText('MULTIPOINT (10 40, 40 30, 20 20, 30 10)')),
  100. ('Mline', ST_GeomFromText('MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))')),
  101. ('Mpoly1', ST_GeomFromText('MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),((15 5, 40 10, 10 20, 5 10, 15 5)))')),
  102. ('Mpoly2', ST_GeomFromText('MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30 20)))')),
  103. ('Gcoll', ST_GeomFromText('GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))'));
  104. DROP TABLE IF EXISTS `events`;
  105. CREATE TABLE `events` (
  106. `id` int(11) NOT NULL AUTO_INCREMENT,
  107. `name` varchar(255) NOT NULL,
  108. `datetime` datetime,
  109. `visitors` bigint(20),
  110. PRIMARY KEY (`id`)
  111. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  112. INSERT INTO `events` (`name`, `datetime`, `visitors`) VALUES
  113. ('Launch', '2016-01-01 13:01:01', 0);
  114. DROP VIEW IF EXISTS `tag_usage`;
  115. CREATE DEFINER = 'php-crud-api' VIEW `tag_usage` AS select `tags`.`id` as `id`, `name`, count(`name`) AS `count` from `tags`, `post_tags` where `tags`.`id` = `post_tags`.`tag_id` group by `tags`.`id`, `name` order by `count` desc, `name`;
  116. DROP TABLE IF EXISTS `products`;
  117. CREATE TABLE `products` (
  118. `id` int(11) NOT NULL AUTO_INCREMENT,
  119. `name` varchar(255) NOT NULL,
  120. `price` decimal(10,2) NOT NULL,
  121. `properties` longtext NOT NULL,
  122. `created_at` datetime NOT NULL,
  123. `deleted_at` datetime,
  124. PRIMARY KEY (`id`)
  125. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  126. INSERT INTO `products` (`name`, `price`, `properties`, `created_at`) VALUES
  127. ('Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
  128. DROP TABLE IF EXISTS `barcodes2`;
  129. DROP TABLE IF EXISTS `barcodes`;
  130. CREATE TABLE `barcodes` (
  131. `id` int(11) NOT NULL AUTO_INCREMENT,
  132. `product_id` int(11) NOT NULL,
  133. `hex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  134. `bin` blob NOT NULL,
  135. `ip_address` varchar(15),
  136. PRIMARY KEY (`id`),
  137. CONSTRAINT `barcodes_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
  138. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  139. INSERT INTO `barcodes` (`product_id`, `hex`, `bin`, `ip_address`) VALUES
  140. (1, '00ff01', UNHEX('00ff01'), '127.0.0.1');
  141. DROP TABLE IF EXISTS `kunsthåndværk`;
  142. CREATE TABLE `kunsthåndværk` (
  143. `id` varchar(36) NOT NULL,
  144. `Umlauts ä_ö_ü-COUNT` int(11) NOT NULL,
  145. `user_id` int(11) NOT NULL,
  146. `invisible` varchar(36),
  147. `invisible_id` varchar(36),
  148. PRIMARY KEY (`id`),
  149. CONSTRAINT `kunsthåndværk_Umlauts ä_ö_ü-COUNT_fkey` UNIQUE (`Umlauts ä_ö_ü-COUNT`),
  150. CONSTRAINT `kunsthåndværk_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  151. CONSTRAINT `kunsthåndværk_invisible_id_fkey` FOREIGN KEY (`invisible_id`) REFERENCES `invisibles` (`id`)
  152. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  153. INSERT INTO `kunsthåndværk` (`id`, `Umlauts ä_ö_ü-COUNT`, `user_id`, `invisible`, `invisible_id`) VALUES
  154. ('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d'),
  155. ('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d');
  156. DROP TABLE IF EXISTS `invisibles`;
  157. CREATE TABLE `invisibles` (
  158. `id` varchar(36) NOT NULL,
  159. PRIMARY KEY (`id`)
  160. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  161. INSERT INTO `invisibles` (`id`) VALUES
  162. ('e42c77c6-06a4-4502-816c-d112c7142e6d');
  163. DROP TABLE IF EXISTS `nopk`;
  164. CREATE TABLE `nopk` (
  165. `id` varchar(36) NOT NULL
  166. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  167. INSERT INTO `nopk` (`id`) VALUES
  168. ('e42c77c6-06a4-4502-816c-d112c7142e6d');
  169. SET foreign_key_checks = 1;
  170. -- 2016-11-05 13:11:47