sentence.sql 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. Navicat Premium Data Transfer
  3. Source Server : Sentence
  4. Source Server Type : SQLite
  5. Source Server Version : 3035005 (3.35.5)
  6. Source Schema : main
  7. Target Server Type : SQLite
  8. Target Server Version : 3035005 (3.35.5)
  9. File Encoding : 65001
  10. Date: 17/08/2023 11:52:09
  11. */
  12. PRAGMA foreign_keys = false;
  13. -- ----------------------------
  14. -- Table structure for channel
  15. -- ----------------------------
  16. DROP TABLE IF EXISTS "channel";
  17. CREATE TABLE "channel" (
  18. "id" VARCHAR,
  19. "name" VARCHAR,
  20. "type" VARCHAR,
  21. "language" VARCHAR,
  22. "summary" VARCHAR,
  23. "owner_id" VARCHAR,
  24. "setting" VARCHAR,
  25. "created_at" DATE,
  26. PRIMARY KEY ("id")
  27. );
  28. -- ----------------------------
  29. -- Table structure for chapter
  30. -- ----------------------------
  31. DROP TABLE IF EXISTS "chapter";
  32. CREATE TABLE "chapter" (
  33. "id" VARCHAR,
  34. "book" INTEGER,
  35. "paragraph" INTEGER,
  36. "language" VARCHAR,
  37. "title" TEXT,
  38. "channel_id" VARCHAR,
  39. "progress" DOUBLE,
  40. "updated_at" DATE
  41. );
  42. -- ----------------------------
  43. -- Table structure for pali_text
  44. -- ----------------------------
  45. DROP TABLE IF EXISTS "pali_text";
  46. CREATE TABLE "pali_text" (
  47. "id" VARCHAR,
  48. "book" INTEGER,
  49. "paragraph" INTEGER,
  50. "level" INTEGER,
  51. "toc" VARCHAR,
  52. "chapter_len" INTEGER,
  53. "parent" INTEGER,
  54. PRIMARY KEY ("id")
  55. );
  56. -- ----------------------------
  57. -- Table structure for sentence
  58. -- ----------------------------
  59. DROP TABLE IF EXISTS "sentence";
  60. CREATE TABLE "sentence" (
  61. "book" INTEGER,
  62. "paragraph" INTEGER,
  63. "word_start" INTEGER,
  64. "word_end" INTEGER,
  65. "content" VARCHAR,
  66. "channel_id" VARCHAR
  67. );
  68. -- ----------------------------
  69. -- Table structure for sentence_translation
  70. -- ----------------------------
  71. DROP TABLE IF EXISTS "sentence_translation";
  72. CREATE TABLE "sentence_translation" (
  73. "book" INTEGER,
  74. "paragraph" INTEGER,
  75. "word_start" INTEGER,
  76. "word_end" INTEGER,
  77. "content" VARCHAR,
  78. "channel_id" VARCHAR
  79. );
  80. -- ----------------------------
  81. -- Table structure for tag
  82. -- ----------------------------
  83. DROP TABLE IF EXISTS "tag";
  84. CREATE TABLE "tag" (
  85. "id" VARCHAR,
  86. "name" VARCHAR,
  87. "description" TIME,
  88. "color" INTEGER,
  89. "owner_id" VARCHAR,
  90. PRIMARY KEY ("id")
  91. );
  92. -- ----------------------------
  93. -- Table structure for tag_map
  94. -- ----------------------------
  95. DROP TABLE IF EXISTS "tag_map";
  96. CREATE TABLE "tag_map" (
  97. "anchor_id" VARCHAR,
  98. "tag_id" VARCHAR
  99. );
  100. DROP TABLE IF EXISTS "dhamma_terms";
  101. CREATE TABLE dhamma_terms (
  102. "uuid" varchar(36) NOT NULL,
  103. "word" varchar(1024) NOT NULL,
  104. "word_en" varchar(1024) NOT NULL,
  105. "meaning" varchar(1024) NOT NULL,
  106. "other_meaning" varchar(1024) NULL,
  107. "note" text NULL,
  108. "tag" varchar(1024) NULL,
  109. "channel_id" varchar(36) NULL,
  110. "language" varchar(16) NOT NULL DEFAULT 'zh-hans',
  111. "owner" varchar(36) NOT NULL,
  112. "editor_id" INTEGER NOT NULL,
  113. "created_at" timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP,
  114. "updated_at" timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP,
  115. "deleted_at" timestamp(0) NULL,
  116. CONSTRAINT dhamma_terms_pkey PRIMARY KEY (uuid)
  117. );
  118. CREATE INDEX "dhamma_terms_channel_index" ON "dhamma_terms" ("channel_id" ASC);
  119. CREATE INDEX "dhamma_terms_created_at_index" ON "dhamma_terms" ("created_at" ASC);
  120. CREATE INDEX "dhamma_terms_editor_id_index" ON "dhamma_terms" ("editor_id" ASC);
  121. CREATE INDEX "dhamma_terms_meaning_index" ON "dhamma_terms" ("meaning" ASC);
  122. CREATE INDEX "dhamma_terms_owner_index" ON "dhamma_terms" ("owner" ASC);
  123. CREATE INDEX "dhamma_terms_updated_at_index" ON "dhamma_terms" ("updated_at" ASC);
  124. CREATE INDEX "dhamma_terms_word_en_index" ON "dhamma_terms" ("word_en" ASC);
  125. CREATE INDEX "dhamma_terms_word_index" ON "dhamma_terms" ("word" ASC);
  126. -- ----------------------------
  127. -- Indexes structure for table channel
  128. -- ----------------------------
  129. CREATE INDEX "channel_id"
  130. ON "channel" (
  131. "id" ASC
  132. );
  133. -- ----------------------------
  134. -- Indexes structure for table chapter
  135. -- ----------------------------
  136. CREATE INDEX "book"
  137. ON "chapter" (
  138. "book" DESC
  139. );
  140. -- ----------------------------
  141. -- Indexes structure for table pali_text
  142. -- ----------------------------
  143. CREATE UNIQUE INDEX "bp"
  144. ON "pali_text" (
  145. "book" ASC,
  146. "paragraph" ASC
  147. );
  148. CREATE UNIQUE INDEX "id"
  149. ON "pali_text" (
  150. "id" DESC
  151. );
  152. -- ----------------------------
  153. -- Indexes structure for table sentence
  154. -- ----------------------------
  155. CREATE INDEX "bps"
  156. ON "sentence" (
  157. "book" ASC,
  158. "paragraph" ASC
  159. );
  160. -- ----------------------------
  161. -- Indexes structure for table sentence_translation
  162. -- ----------------------------
  163. CREATE INDEX "bpst"
  164. ON "sentence_translation" (
  165. "book" ASC,
  166. "paragraph" ASC
  167. );
  168. -- ----------------------------
  169. -- Indexes structure for table tag
  170. -- ----------------------------
  171. CREATE UNIQUE INDEX "name"
  172. ON "tag" (
  173. "name",
  174. "owner_id"
  175. );
  176. -- ----------------------------
  177. -- Indexes structure for table tag_map
  178. -- ----------------------------
  179. CREATE INDEX "tag_id"
  180. ON "tag_map" (
  181. "tag_id" DESC
  182. );
  183. PRAGMA foreign_keys = true;