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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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" text NOT NULL,
  17. "category_id" integer NOT NULL,
  18. FOREIGN KEY ("post_id") REFERENCES "posts" ("id"),
  19. FOREIGN KEY ("category_id") REFERENCES "categories" ("id")
  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 "post_tags";
  28. CREATE TABLE "post_tags" (
  29. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  30. "post_id" integer NOT NULL,
  31. "tag_id" integer NOT NULL,
  32. FOREIGN KEY ("tag_id") REFERENCES "tags" ("id"),
  33. FOREIGN KEY ("post_id") REFERENCES "posts" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  34. );
  35. CREATE UNIQUE INDEX "post_tags_post_id_tag_id" ON "post_tags" ("post_id", "tag_id");
  36. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (1, 1, 1);
  37. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (2, 1, 2);
  38. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (3, 2, 1);
  39. INSERT INTO "post_tags" ("id", "post_id", "tag_id") VALUES (4, 2, 2);
  40. DROP TABLE IF EXISTS "posts";
  41. CREATE TABLE "posts" (
  42. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  43. "user_id" integer NOT NULL,
  44. "category_id" integer NOT NULL,
  45. "content" text NOT NULL,
  46. FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  47. FOREIGN KEY ("category_id") REFERENCES "categories" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  48. );
  49. CREATE INDEX "posts_user_id" ON "posts" ("user_id");
  50. CREATE INDEX "posts_category_id" ON "posts" ("category_id");
  51. INSERT INTO "posts" ("id", "user_id", "category_id", "content") VALUES (1, 1, 1, 'blog started');
  52. INSERT INTO "posts" ("id", "user_id", "category_id", "content") VALUES (2, 1, 2, 'It works!');
  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" clob 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', 'pass2', 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" clob 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 NOT NULL,
  92. "visitors" integer NOT NULL
  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 "name", count("name") AS "count" from "tags", "post_tags" where "tags"."id" = "post_tags"."tag_id" group by "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" varchar(12) 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 "barcodes";
  108. CREATE TABLE "barcodes" (
  109. "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  110. "product_id" integer NOT NULL,
  111. "hex" varchar(255) NOT NULL,
  112. "bin" blob NOT NULL
  113. );
  114. INSERT INTO "barcodes" ("id", "product_id", "hex", "bin") VALUES (1, 1, '00ff01', 'AP8B');
  115. DROP TABLE IF EXISTS "kunsthåndværk";
  116. CREATE TABLE "kunsthåndværk" (
  117. "id" varchar(36) NOT NULL PRIMARY KEY,
  118. "Umlauts ä_ö_ü-COUNT" integer NOT NULL UNIQUE,
  119. "user_id" integer NOT NULL,
  120. "invisible" varchar(36),
  121. FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
  122. );
  123. INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible") VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL);
  124. INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible") VALUES ('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL);
  125. PRAGMA foreign_keys = on;
  126. --