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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. -- Adminer 4.2.4 SQLite 3 dump
  2. PRAGMA foreign_keys = off;
  3. DROP TABLE IF EXISTS "categories";
  4. CREATE TABLE "categories" (
  5. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  6. "name" varchar(255) NOT NULL,
  7. "icon" blob NULL
  8. );
  9. INSERT INTO "categories" ("id", "name", "icon") VALUES (1, 'announcement', NULL);
  10. INSERT INTO "categories" ("id", "name", "icon") VALUES (2, 'article', NULL);
  11. INSERT INTO "categories" ("id", "name", "icon") VALUES (3, 'comment', NULL);
  12. DROP TABLE IF EXISTS "comments";
  13. CREATE TABLE "comments" (
  14. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  15. "post_id" integer NOT NULL,
  16. "message" VARCHAR(255) NOT NULL,
  17. "category_id" integer NOT NULL,
  18. FOREIGN KEY ("post_id") REFERENCES "posts" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  19. FOREIGN KEY ("category_id") REFERENCES "categories" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  20. );
  21. CREATE INDEX "comments_post_id" ON "comments" ("post_id");
  22. CREATE INDEX "comments_category_id" ON "comments" ("category_id");
  23. INSERT INTO "comments" ("id", "post_id", "message", "category_id") VALUES (1, 1, 'great', 3);
  24. INSERT INTO "comments" ("id", "post_id", "message", "category_id") VALUES (2, 1, 'fantastic', 3);
  25. INSERT INTO "comments" ("id", "post_id", "message", "category_id") VALUES (3, 2, 'thank you', 3);
  26. INSERT INTO "comments" ("id", "post_id", "message", "category_id") VALUES (4, 2, 'awesome', 3);
  27. DROP TABLE IF EXISTS "posts";
  28. CREATE TABLE "posts" (
  29. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  30. "user_id" integer NOT NULL,
  31. "category_id" integer NOT NULL,
  32. "content" varchar(255) NOT NULL,
  33. FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  34. FOREIGN KEY ("category_id") REFERENCES "categories" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  35. );
  36. CREATE INDEX "posts_user_id" ON "posts" ("user_id");
  37. CREATE INDEX "posts_category_id" ON "posts" ("category_id");
  38. INSERT INTO "posts" ("id", "user_id", "category_id", "content") VALUES (1, 1, 1, 'blog started');
  39. INSERT INTO "posts" ("id", "user_id", "category_id", "content") VALUES (2, 1, 2, 'It works!');
  40. DROP TABLE IF EXISTS "post_tags";
  41. CREATE TABLE "post_tags" (
  42. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  43. "post_id" integer NOT NULL,
  44. "tag_id" integer NOT NULL,
  45. FOREIGN KEY ("tag_id") REFERENCES "tags" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  46. FOREIGN KEY ("post_id") REFERENCES "posts" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  47. );
  48. CREATE UNIQUE INDEX "post_tags_post_id_tag_id" ON "post_tags" ("post_id", "tag_id");
  49. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (1, 1, 1);
  50. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (2, 1, 2);
  51. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (3, 2, 1);
  52. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (4, 2, 2);
  53. DROP TABLE IF EXISTS "tags";
  54. CREATE TABLE "tags" (
  55. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  56. "name" varchar(255) NOT NULL,
  57. "is_important" boolean NOT NULL
  58. );
  59. INSERT INTO "tags" ("id", "name", "is_important") VALUES (1, 'funny', 0);
  60. INSERT INTO "tags" ("id", "name", "is_important") VALUES (2, 'important', 1);
  61. DROP TABLE IF EXISTS "users";
  62. CREATE TABLE "users" (
  63. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  64. "username" varchar(255) NOT NULL,
  65. "password" varchar(255) NOT NULL,
  66. "location" text NULL
  67. );
  68. INSERT INTO "users" ("id", "username", "password", "location") VALUES (1, 'user1', 'pass1', NULL);
  69. INSERT INTO "users" ("id", "username", "password", "location") VALUES (2, 'user2', '$2y$10$cg7/nswxVZ0cmVIsMB/pVOh1OfcHScBJGq7Xu4KF9dFEQgRZ8HWe.', NULL);
  70. DROP TABLE IF EXISTS "countries";
  71. CREATE TABLE "countries" (
  72. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  73. "name" varchar(255) NOT NULL,
  74. "shape" text NOT NULL
  75. );
  76. INSERT INTO "countries" ("id", "name", "shape") VALUES (1, 'Left', 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))');
  77. INSERT INTO "countries" ("id", "name", "shape") VALUES (2, 'Right', 'POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))');
  78. INSERT INTO "countries" ("id", "name", "shape") VALUES (3, 'Point', 'POINT (30 10)');
  79. INSERT INTO "countries" ("id", "name", "shape") VALUES (4, 'Line', 'LINESTRING (30 10, 10 30, 40 40)');
  80. INSERT INTO "countries" ("id", "name", "shape") VALUES (5, 'Poly1', 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))');
  81. INSERT INTO "countries" ("id", "name", "shape") VALUES (6, 'Poly2', 'POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))');
  82. INSERT INTO "countries" ("id", "name", "shape") VALUES (7, 'Mpoint', 'MULTIPOINT (10 40, 40 30, 20 20, 30 10)');
  83. INSERT INTO "countries" ("id", "name", "shape") VALUES (8, 'Mline', 'MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))');
  84. INSERT INTO "countries" ("id", "name", "shape") VALUES (9, 'Mpoly1', 'MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),((15 5, 40 10, 10 20, 5 10, 15 5)))');
  85. INSERT INTO "countries" ("id", "name", "shape") VALUES (10, 'Mpoly2', '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)))');
  86. INSERT INTO "countries" ("id", "name", "shape") VALUES (11, 'Gcoll', 'GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))');
  87. DROP TABLE IF EXISTS "events";
  88. CREATE TABLE "events" (
  89. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  90. "name" varchar(255) NOT NULL,
  91. "datetime" datetime,
  92. "visitors" bigint
  93. );
  94. INSERT INTO "events" ("id", "name", "datetime", "visitors") VALUES (1, 'Launch', '2016-01-01 13:01:01', 0);
  95. DROP VIEW IF EXISTS "tag_usage";
  96. CREATE 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";
  97. DROP TABLE IF EXISTS "products";
  98. CREATE TABLE "products" (
  99. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  100. "name" varchar(255) NOT NULL,
  101. "price" decimal(10,2) NOT NULL,
  102. "properties" clob NOT NULL,
  103. "created_at" datetime NOT NULL,
  104. "deleted_at" datetime NULL
  105. );
  106. 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');
  107. DROP TABLE IF EXISTS "barcodes2";
  108. DROP TABLE IF EXISTS "barcodes";
  109. CREATE TABLE "barcodes" (
  110. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  111. "product_id" integer NOT NULL,
  112. "hex" varchar(255) NOT NULL,
  113. "bin" blob NOT NULL,
  114. "ip_address" varchar(15),
  115. FOREIGN KEY ("product_id") REFERENCES "products" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  116. );
  117. INSERT INTO "barcodes" ("id", "product_id", "hex", "bin", "ip_address") VALUES (1, 1, '00ff01', 'AP8B', '127.0.0.1');
  118. DROP TABLE IF EXISTS "kunsthåndværk";
  119. CREATE TABLE "kunsthåndværk" (
  120. "id" varchar(36) NOT NULL PRIMARY KEY,
  121. "Umlauts ä_ö_ü-COUNT" integer NOT NULL UNIQUE,
  122. "user_id" integer NOT NULL,
  123. "invisible" varchar(36),
  124. "invisible_id" varchar(36),
  125. FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  126. FOREIGN KEY ("invisible_id") REFERENCES "invisibles" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  127. );
  128. INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible", "invisible_id") VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d');
  129. INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible", "invisible_id") VALUES ('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d');
  130. DROP TABLE IF EXISTS "invisibles";
  131. CREATE TABLE "invisibles" (
  132. "id" varchar(36) NOT NULL PRIMARY KEY
  133. );
  134. INSERT INTO "invisibles" ("id") VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d');
  135. DROP TABLE IF EXISTS "nopk";
  136. CREATE TABLE "nopk" (
  137. "id" varchar(36) NOT NULL
  138. );
  139. INSERT INTO "nopk" ("id") VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d');
  140. PRAGMA foreign_keys = on;
  141. --