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.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 NOT NULL,
  96. `visitors` int(11) NOT NULL,
  97. PRIMARY KEY (`id`)
  98. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  99. INSERT INTO `events` (`id`, `name`, `datetime`, `visitors`) VALUES
  100. (1, 'Launch', '2016-01-01 13:01:01', 0);
  101. DROP VIEW IF EXISTS `tag_usage`;
  102. 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`;
  103. DROP TABLE IF EXISTS `products`;
  104. CREATE TABLE `products` (
  105. `id` int(11) NOT NULL AUTO_INCREMENT,
  106. `name` varchar(255) NOT NULL,
  107. `price` decimal(10,2) NOT NULL,
  108. `properties` JSON NOT NULL,
  109. `created_at` datetime NOT NULL,
  110. `deleted_at` datetime NULL,
  111. PRIMARY KEY (`id`)
  112. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  113. INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES
  114. (1, 'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
  115. DROP TABLE IF EXISTS `barcodes`;
  116. CREATE TABLE `barcodes` (
  117. `id` int(11) NOT NULL AUTO_INCREMENT,
  118. `product_id` int(11) NOT NULL,
  119. `hex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  120. `bin` varbinary(255) NOT NULL,
  121. PRIMARY KEY (`id`),
  122. CONSTRAINT `barcodes_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
  123. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  124. INSERT INTO `barcodes` (`id`, `product_id`, `hex`, `bin`) VALUES
  125. (1, 1, '00ff01', UNHEX('00ff01'));
  126. -- 2016-11-05 13:11:47