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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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" blob NULL
  7. );
  8. INSERT INTO "categories" ("id", "name", "icon") VALUES (1, 'anouncement', 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. );
  61. INSERT INTO "users" ("id", "username", "password") VALUES (1, 'user1', 'pass1');
  62. INSERT INTO "users" ("id", "username", "password") VALUES (2, 'user2', 'pass2');
  63. --