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_sqlite.sql 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. -- Adminer 4.2.4 SQLite 3 dump
  2. DROP TABLE IF EXISTS "categories";
  3. CREATE TABLE "categories" (
  4. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  5. "name" text(255) NOT NULL,
  6. "icon" data NULL
  7. );
  8. INSERT INTO "categories" ("id", "name", "icon") VALUES (1, 'announcement', NULL);
  9. INSERT INTO "categories" ("id", "name", "icon") VALUES (2, 'article', NULL);
  10. DROP TABLE IF EXISTS "comments";
  11. CREATE TABLE "comments" (
  12. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  13. "post_id" integer NOT NULL,
  14. "message" text NOT NULL,
  15. FOREIGN KEY ("post_id") REFERENCES "posts" ("id")
  16. );
  17. CREATE INDEX "comments_post_id" ON "comments" ("post_id");
  18. INSERT INTO "comments" ("id", "post_id", "message") VALUES (1, 1, 'great');
  19. INSERT INTO "comments" ("id", "post_id", "message") VALUES (2, 1, 'fantastic');
  20. INSERT INTO "comments" ("id", "post_id", "message") VALUES (3, 2, 'thank you');
  21. INSERT INTO "comments" ("id", "post_id", "message") VALUES (4, 2, 'awesome');
  22. DROP TABLE IF EXISTS "post_tags";
  23. CREATE TABLE "post_tags" (
  24. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  25. "post_id" integer NOT NULL,
  26. "tag_id" integer NOT NULL,
  27. FOREIGN KEY ("tag_id") REFERENCES "tags" ("id"),
  28. FOREIGN KEY ("post_id") REFERENCES "posts" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  29. );
  30. CREATE UNIQUE INDEX "post_tags_post_id_tag_id" ON "post_tags" ("post_id", "tag_id");
  31. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (1, 1, 1);
  32. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (2, 1, 2);
  33. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (3, 2, 1);
  34. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (4, 2, 2);
  35. DROP TABLE IF EXISTS "posts";
  36. CREATE TABLE "posts" (
  37. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  38. "user_id" integer NOT NULL,
  39. "category_id" integer NOT NULL,
  40. "content" text NOT NULL,
  41. FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  42. FOREIGN KEY ("category_id") REFERENCES "categories" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  43. );
  44. CREATE INDEX "posts_user_id" ON "posts" ("user_id");
  45. CREATE INDEX "posts_category_id" ON "posts" ("category_id");
  46. INSERT INTO "posts" ("id", "user_id", "category_id", "content") VALUES (1, 1, 1, 'blog started');
  47. INSERT INTO "posts" ("id", "user_id", "category_id", "content") VALUES (2, 1, 2, 'It works!');
  48. DROP TABLE IF EXISTS "tags";
  49. CREATE TABLE `tags` (
  50. `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  51. `name` text(255) NOT NULL
  52. );
  53. INSERT INTO "tags" ("id", "name") VALUES (1, 'funny');
  54. INSERT INTO "tags" ("id", "name") VALUES (2, 'important');
  55. DROP TABLE IF EXISTS "users";
  56. CREATE TABLE `users` (
  57. `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  58. `username` text(255) NOT NULL,
  59. `password` text(255) NOT NULL,
  60. `location` geometry NULL
  61. );
  62. INSERT INTO "users" ("id", "username", "password", "location") VALUES (1, 'user1', 'pass1', NULL);
  63. INSERT INTO "users" ("id", "username", "password", "location") VALUES (2, 'user2', 'pass2', NULL);
  64. DROP TABLE IF EXISTS `countries`;
  65. CREATE TABLE `countries` (
  66. `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  67. `name` text(255) NOT NULL,
  68. `shape` geometry NOT NULL
  69. );
  70. INSERT INTO `countries` (`id`, `name`, `shape`) VALUES (1, 'Left', 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))');
  71. INSERT INTO `countries` (`id`, `name`, `shape`) VALUES (2, 'Right', 'POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))');
  72. DROP TABLE IF EXISTS `events`;
  73. CREATE TABLE `events` (
  74. `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  75. `name` text(255) NOT NULL,
  76. `datetime` datetime NOT NULL,
  77. `visitors` integer NOT NULL
  78. );
  79. INSERT INTO `events` (`id`, `name`, `datetime`, `visitors`) VALUES (1, 'Launch', '2016-01-01 13:01:01', 0);
  80. DROP VIEW IF EXISTS `tag_usage`;
  81. 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`;
  82. DROP TABLE IF EXISTS `products`;
  83. CREATE TABLE `products` (
  84. `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  85. `name` text(255) NOT NULL,
  86. `price` text(12) NOT NULL,
  87. `properties` json NOT NULL,
  88. `created_at` datetime NOT NULL,
  89. `deleted_at` datetime NULL
  90. );
  91. INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES (1, 'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
  92. DROP TABLE IF EXISTS `barcodes`;
  93. CREATE TABLE `barcodes` (
  94. `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  95. `product_id` integer NOT NULL,
  96. `hex` text(255) NOT NULL,
  97. `bin` binary(255) NOT NULL
  98. );
  99. INSERT INTO `barcodes` (`id`, `product_id`, `hex`, `bin`) VALUES (1, 1, '00ff01', 'AP8B');
  100. --