visuddhinanda hai 2 meses
pai
achega
d386f697f7
Modificáronse 100 ficheiros con 4265 adicións e 0 borrados
  1. 203 0
      api-v12/database/export/sentence.sql
  2. 36 0
      api-v12/database/migrations/2014_10_12_000000_create_users_table.php
  3. 32 0
      api-v12/database/migrations/2014_10_12_100000_create_password_resets_table.php
  4. 36 0
      api-v12/database/migrations/2019_08_19_000000_create_failed_jobs_table.php
  5. 36 0
      api-v12/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php
  6. 43 0
      api-v12/database/migrations/2021_12_28_152353_create_wbw_templates_table.php
  7. 47 0
      api-v12/database/migrations/2021_12_28_220331_create_res_indices_table.php
  8. 48 0
      api-v12/database/migrations/2021_12_28_222244_create_pali_texts_table.php
  9. 34 0
      api-v12/database/migrations/2021_12_28_223422_create_book_words_table.php
  10. 35 0
      api-v12/database/migrations/2021_12_28_223702_create_book_titles_table.php
  11. 39 0
      api-v12/database/migrations/2021_12_29_020248_create_word_lists_table.php
  12. 39 0
      api-v12/database/migrations/2021_12_29_021525_create_word_indices_table.php
  13. 39 0
      api-v12/database/migrations/2021_12_29_022234_create_bolds_table.php
  14. 39 0
      api-v12/database/migrations/2021_12_29_022844_create_word_statistics_table.php
  15. 44 0
      api-v12/database/migrations/2021_12_29_023712_create_pali_sentences_table.php
  16. 45 0
      api-v12/database/migrations/2021_12_29_025006_create_pali_sent_orgs_table.php
  17. 37 0
      api-v12/database/migrations/2021_12_29_025311_create_pali_sent_indices_table.php
  18. 35 0
      api-v12/database/migrations/2021_12_29_030034_create_sent_sims_table.php
  19. 34 0
      api-v12/database/migrations/2021_12_29_030248_create_sent_sim_indices_table.php
  20. 40 0
      api-v12/database/migrations/2021_12_29_050502_create_progress_table.php
  21. 37 0
      api-v12/database/migrations/2021_12_29_051305_create_progress_chapters_table.php
  22. 40 0
      api-v12/database/migrations/2021_12_29_051725_create_fts_texts_table.php
  23. 104 0
      api-v12/database/migrations/2021_12_30_053602_add_func_to_fts_texts_table.php
  24. 51 0
      api-v12/database/migrations/2022_01_19_090727_create_wbws_table.php
  25. 62 0
      api-v12/database/migrations/2022_01_19_110604_create_wbw_blocks_table.php
  26. 46 0
      api-v12/database/migrations/2022_01_20_135745_create_channels_table.php
  27. 59 0
      api-v12/database/migrations/2022_01_22_152901_create_sentences_table.php
  28. 72 0
      api-v12/database/migrations/2022_01_27_130346_create_sent_blocks_table.php
  29. 57 0
      api-v12/database/migrations/2022_01_27_132319_create_sent_prs_table.php
  30. 47 0
      api-v12/database/migrations/2022_01_27_133456_create_sent_histories_table.php
  31. 56 0
      api-v12/database/migrations/2022_01_28_081954_create_user_dicts_table.php
  32. 38 0
      api-v12/database/migrations/2022_01_28_092534_create_user_operation_dailies_table.php
  33. 40 0
      api-v12/database/migrations/2022_01_28_102330_create_user_operation_frames_table.php
  34. 56 0
      api-v12/database/migrations/2022_01_28_105209_create_user_operation_logs_table.php
  35. 54 0
      api-v12/database/migrations/2022_01_28_121154_create_articles_table.php
  36. 53 0
      api-v12/database/migrations/2022_01_28_123829_create_collections_table.php
  37. 41 0
      api-v12/database/migrations/2022_01_28_124816_create_article_collections_table.php
  38. 50 0
      api-v12/database/migrations/2022_02_02_103531_create_dhamma_terms_table.php
  39. 47 0
      api-v12/database/migrations/2022_02_04_012828_create_shares_table.php
  40. 41 0
      api-v12/database/migrations/2022_02_05_020339_create_group_infos_table.php
  41. 43 0
      api-v12/database/migrations/2022_02_05_024244_create_group_members_table.php
  42. 57 0
      api-v12/database/migrations/2022_02_06_075148_create_file_indices_table.php
  43. 59 0
      api-v12/database/migrations/2022_02_07_012707_create_wbw_analyses_table.php
  44. 39 0
      api-v12/database/migrations/2022_02_11_090826_create_custom_books_table.php
  45. 49 0
      api-v12/database/migrations/2022_02_13_024642_create_custom_book_sentences_table.php
  46. 34 0
      api-v12/database/migrations/2022_02_14_094254_create_custom_book_ids_table.php
  47. 38 0
      api-v12/database/migrations/2022_02_27_103552_add_channel_to_progress_chapter.php
  48. 34 0
      api-v12/database/migrations/2022_02_27_151744_add_channel_to_progress.php
  49. 34 0
      api-v12/database/migrations/2022_05_20_144400_add_path_into_pali_texts.php
  50. 39 0
      api-v12/database/migrations/2022_05_22_142016_create_tags_table.php
  51. 38 0
      api-v12/database/migrations/2022_05_22_143716_create_tag_maps_table.php
  52. 35 0
      api-v12/database/migrations/2022_05_23_010426_use_uuid_in_pali_texts.php
  53. 35 0
      api-v12/database/migrations/2022_05_23_070112_add_uuid_in_progress_chapters.php
  54. 35 0
      api-v12/database/migrations/2022_05_25_054449_add_uuid_in_channels.php
  55. 58 0
      api-v12/database/migrations/2022_05_25_075215_rename_uuid_to_uid_in_channels.php
  56. 36 0
      api-v12/database/migrations/2022_05_27_072344_create_views_table.php
  57. 34 0
      api-v12/database/migrations/2022_05_28_120007_add_summary_in_progress_chapters.php
  58. 46 0
      api-v12/database/migrations/2022_05_29_103822_create_likes_table.php
  59. 40 0
      api-v12/database/migrations/2022_06_03_021251_create_user_experiences_table.php
  60. 40 0
      api-v12/database/migrations/2022_06_18_134823_add_title_in_views.php
  61. 40 0
      api-v12/database/migrations/2022_08_11_064121_create_dict_infos_table.php
  62. 34 0
      api-v12/database/migrations/2022_08_11_095714_add_dictid_in_user_dicts.php
  63. 33 0
      api-v12/database/migrations/2022_08_12_134209_create_word_parts_table.php
  64. 34 0
      api-v12/database/migrations/2022_08_14_131951_add_realindex_in_wbw_templates.php
  65. 34 0
      api-v12/database/migrations/2022_08_14_133812_add_sourceindex_in_user_dicts.php
  66. 34 0
      api-v12/database/migrations/2022_08_14_140946_add_flag_in_user_dicts.php
  67. 40 0
      api-v12/database/migrations/2022_12_19_125601_create_discussions_table.php
  68. 41 0
      api-v12/database/migrations/2022_12_29_125609_create_courses_table.php
  69. 37 0
      api-v12/database/migrations/2022_12_29_125646_create_course_members_table.php
  70. 38 0
      api-v12/database/migrations/2023_01_24_131456_add_anthology_in_courses.php
  71. 38 0
      api-v12/database/migrations/2023_02_02_135125_add_join_in_courses.php
  72. 35 0
      api-v12/database/migrations/2023_02_10_052603_create_vocabularies_table.php
  73. 34 0
      api-v12/database/migrations/2023_02_17_025306_change_confidence_in_user_dicts.php
  74. 36 0
      api-v12/database/migrations/2023_02_19_122318_add_index_created_at_in_sentences.php
  75. 34 0
      api-v12/database/migrations/2023_02_25_124246_add_content_type_in_discussions.php
  76. 38 0
      api-v12/database/migrations/2023_03_08_083306_add_accept_in_sentences.php
  77. 40 0
      api-v12/database/migrations/2023_03_14_153653_create_nissaya_endings_table.php
  78. 37 0
      api-v12/database/migrations/2023_03_14_153724_create_relations_table.php
  79. 39 0
      api-v12/database/migrations/2023_03_27_021002_create_related_paragraphs_table.php
  80. 33 0
      api-v12/database/migrations/2023_03_29_132614_add_pcd_book_in_fts_texts.php
  81. 33 0
      api-v12/database/migrations/2023_04_04_014330_add_book_id_in_wbw_templates.php
  82. 34 0
      api-v12/database/migrations/2023_04_04_142510_add_index_type_in_wbw_templates.php
  83. 34 0
      api-v12/database/migrations/2023_04_05_132106_add_strlen_in_vocabularies.php
  84. 35 0
      api-v12/database/migrations/2023_04_09_070539_add_deleted_at_article_collections.php
  85. 47 0
      api-v12/database/migrations/2023_05_17_125307_create_user_infos_table.php
  86. 41 0
      api-v12/database/migrations/2023_06_10_005253_change_content_type_in_sentences.php
  87. 40 0
      api-v12/database/migrations/2023_06_15_021837_create_attachments_table.php
  88. 37 0
      api-v12/database/migrations/2023_07_02_110904_create_recents_table.php
  89. 34 0
      api-v12/database/migrations/2023_07_10_111723_create_invites_table.php
  90. 34 0
      api-v12/database/migrations/2023_07_18_015852_add_from_in_relations.php
  91. 34 0
      api-v12/database/migrations/2023_07_21_023409_add_category_in_relations.php
  92. 34 0
      api-v12/database/migrations/2023_07_21_122748_add_from_in_nissaya_endings.php
  93. 34 0
      api-v12/database/migrations/2023_07_22_003004_add_match_in_relations.php
  94. 36 0
      api-v12/database/migrations/2023_07_29_132052_add_index_created_at_in_user_dicts.php
  95. 34 0
      api-v12/database/migrations/2023_08_06_125849_add_config_in_channels.php
  96. 40 0
      api-v12/database/migrations/2023_08_07_113207_create_web_hooks_table.php
  97. 34 0
      api-v12/database/migrations/2023_08_15_135700_add_status_in_discussions.php
  98. 34 0
      api-v12/database/migrations/2023_08_20_143627_add_sn_in_book_titles.php
  99. 34 0
      api-v12/database/migrations/2023_09_17_113229_add_tpl_in_discussions.php
  100. 38 0
      api-v12/database/migrations/2023_09_19_014131_add_titleen_in_pali_texts.php

+ 203 - 0
api-v12/database/export/sentence.sql

@@ -0,0 +1,203 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : Sentence
+ Source Server Type    : SQLite
+ Source Server Version : 3035005 (3.35.5)
+ Source Schema         : main
+
+ Target Server Type    : SQLite
+ Target Server Version : 3035005 (3.35.5)
+ File Encoding         : 65001
+
+ Date: 17/08/2023 11:52:09
+*/
+
+PRAGMA foreign_keys = false;
+
+-- ----------------------------
+-- Table structure for channel
+-- ----------------------------
+DROP TABLE IF EXISTS "channel";
+CREATE TABLE "channel" (
+  "id" VARCHAR,
+  "name" VARCHAR,
+  "type" VARCHAR,
+  "language" VARCHAR,
+  "summary" VARCHAR,
+  "owner_id" VARCHAR,
+  "setting" VARCHAR,
+  "created_at" DATE,
+  PRIMARY KEY ("id")
+);
+
+-- ----------------------------
+-- Table structure for chapter
+-- ----------------------------
+DROP TABLE IF EXISTS "chapter";
+CREATE TABLE "chapter" (
+  "id" VARCHAR,
+  "book" INTEGER,
+  "paragraph" INTEGER,
+  "language" VARCHAR,
+  "title" TEXT,
+  "channel_id" VARCHAR,
+  "progress" DOUBLE,
+  "updated_at" DATE
+);
+
+-- ----------------------------
+-- Table structure for pali_text
+-- ----------------------------
+DROP TABLE IF EXISTS "pali_text";
+CREATE TABLE "pali_text" (
+  "id" VARCHAR,
+  "book" INTEGER,
+  "paragraph" INTEGER,
+  "level" INTEGER,
+  "toc" VARCHAR,
+  "chapter_len" INTEGER,
+  "parent" INTEGER,
+  PRIMARY KEY ("id")
+);
+
+-- ----------------------------
+-- Table structure for sentence
+-- ----------------------------
+DROP TABLE IF EXISTS "sentence";
+CREATE TABLE "sentence" (
+  "book" INTEGER,
+  "paragraph" INTEGER,
+  "word_start" INTEGER,
+  "word_end" INTEGER,
+  "content" VARCHAR,
+  "channel_id" VARCHAR
+);
+
+-- ----------------------------
+-- Table structure for sentence_translation
+-- ----------------------------
+DROP TABLE IF EXISTS "sentence_translation";
+CREATE TABLE "sentence_translation" (
+  "book" INTEGER,
+  "paragraph" INTEGER,
+  "word_start" INTEGER,
+  "word_end" INTEGER,
+  "content" VARCHAR,
+  "channel_id" VARCHAR
+);
+
+-- ----------------------------
+-- Table structure for tag
+-- ----------------------------
+DROP TABLE IF EXISTS "tag";
+CREATE TABLE "tag" (
+  "id" VARCHAR,
+  "name" VARCHAR,
+  "description" TIME,
+  "color" INTEGER,
+  "owner_id" VARCHAR,
+  PRIMARY KEY ("id")
+);
+
+-- ----------------------------
+-- Table structure for tag_map
+-- ----------------------------
+DROP TABLE IF EXISTS "tag_map";
+CREATE TABLE "tag_map" (
+  "anchor_id" VARCHAR,
+  "tag_id" VARCHAR
+);
+
+DROP TABLE IF EXISTS "dhamma_terms";
+CREATE TABLE dhamma_terms (
+	"uuid" varchar(36) NOT NULL,
+	"word" varchar(1024) NOT NULL,
+	"word_en" varchar(1024) NOT NULL,
+	"meaning" varchar(1024) NOT NULL,
+	"other_meaning" varchar(1024) NULL,
+	"note" text NULL,
+	"tag" varchar(1024) NULL,
+	"channel_id" varchar(36) NULL,
+	"language" varchar(16) NOT NULL DEFAULT 'zh-hans',
+	"owner" varchar(36) NOT NULL,
+	"editor_id" INTEGER NOT NULL,
+	"created_at" timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP,
+	"updated_at" timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP,
+	"deleted_at" timestamp(0) NULL,
+	CONSTRAINT dhamma_terms_pkey PRIMARY KEY (uuid)
+);
+CREATE INDEX "dhamma_terms_channel_index" ON "dhamma_terms"  ("channel_id" ASC);
+CREATE INDEX "dhamma_terms_created_at_index" ON "dhamma_terms"  ("created_at" ASC);
+CREATE INDEX "dhamma_terms_editor_id_index" ON "dhamma_terms"  ("editor_id" ASC);
+CREATE INDEX "dhamma_terms_meaning_index" ON "dhamma_terms"  ("meaning" ASC);
+CREATE INDEX "dhamma_terms_owner_index" ON "dhamma_terms"  ("owner" ASC);
+CREATE INDEX "dhamma_terms_updated_at_index" ON "dhamma_terms"  ("updated_at" ASC);
+CREATE INDEX "dhamma_terms_word_en_index" ON "dhamma_terms"  ("word_en" ASC);
+CREATE INDEX "dhamma_terms_word_index" ON "dhamma_terms"  ("word" ASC);
+
+-- ----------------------------
+-- Indexes structure for table channel
+-- ----------------------------
+CREATE INDEX "channel_id"
+ON "channel" (
+  "id" ASC
+);
+
+-- ----------------------------
+-- Indexes structure for table chapter
+-- ----------------------------
+CREATE INDEX "book"
+ON "chapter" (
+  "book" DESC
+);
+
+-- ----------------------------
+-- Indexes structure for table pali_text
+-- ----------------------------
+CREATE UNIQUE INDEX "bp"
+ON "pali_text" (
+  "book" ASC,
+  "paragraph" ASC
+);
+CREATE UNIQUE INDEX "id"
+ON "pali_text" (
+  "id" DESC
+);
+
+-- ----------------------------
+-- Indexes structure for table sentence
+-- ----------------------------
+CREATE INDEX "bps"
+ON "sentence" (
+  "book" ASC,
+  "paragraph" ASC
+);
+
+-- ----------------------------
+-- Indexes structure for table sentence_translation
+-- ----------------------------
+CREATE INDEX "bpst"
+ON "sentence_translation" (
+  "book" ASC,
+  "paragraph" ASC
+);
+
+-- ----------------------------
+-- Indexes structure for table tag
+-- ----------------------------
+CREATE UNIQUE INDEX "name"
+ON "tag" (
+  "name",
+  "owner_id"
+);
+
+-- ----------------------------
+-- Indexes structure for table tag_map
+-- ----------------------------
+CREATE INDEX "tag_id"
+ON "tag_map" (
+  "tag_id" DESC
+);
+
+PRAGMA foreign_keys = true;

+ 36 - 0
api-v12/database/migrations/2014_10_12_000000_create_users_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class  extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('users', function (Blueprint $table) {
+            $table->id();
+            $table->string('name');
+            $table->string('email')->unique();
+            $table->timestamp('email_verified_at')->nullable();
+            $table->string('password');
+            $table->rememberToken();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('users');
+    }
+};

+ 32 - 0
api-v12/database/migrations/2014_10_12_100000_create_password_resets_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class  extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('password_resets', function (Blueprint $table) {
+            $table->string('email')->index();
+            $table->string('token');
+            $table->timestamp('created_at')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('password_resets');
+    }
+};

+ 36 - 0
api-v12/database/migrations/2019_08_19_000000_create_failed_jobs_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class  extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('failed_jobs', function (Blueprint $table) {
+            $table->id();
+            $table->string('uuid')->unique();
+            $table->text('connection');
+            $table->text('queue');
+            $table->longText('payload');
+            $table->longText('exception');
+            $table->timestamp('failed_at')->useCurrent();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('failed_jobs');
+    }
+};

+ 36 - 0
api-v12/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('personal_access_tokens', function (Blueprint $table) {
+            $table->id();
+            $table->morphs('tokenable');
+            $table->string('name');
+            $table->string('token', 64)->unique();
+            $table->text('abilities')->nullable();
+            $table->timestamp('last_used_at')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('personal_access_tokens');
+    }
+};

+ 43 - 0
api-v12/database/migrations/2021_12_28_152353_create_wbw_templates_table.php

@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class  extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('wbw_templates', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->integer('wid');
+            $table->string('word', 1024)->index();
+            $table->string('real', 1024);
+            $table->string('type', 64);
+            $table->string('gramma', 64);
+            $table->string('part', 1024);
+            $table->string('style', 64);
+            $table->timestamps();
+
+            $table->index(["book", "paragraph", "wid"]);
+            $table->index(["book", "paragraph"]);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('wbw_templates');
+    }
+};

+ 47 - 0
api-v12/database/migrations/2021_12_28_220331_create_res_indices_table.php

@@ -0,0 +1,47 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::create('res_indices', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->string('title', 1024)->index();
+            $table->string('title_en', 1024)->index();
+            $table->integer('level');
+            $table->integer('type');
+            $table->string('language', 16);
+            $table->string('author', 256)->nullable();
+            $table->integer('editor')->default(0);
+            $table->integer('share')->default(1);
+            $table->integer('edition')->default(1);
+            $table->integer('hit')->default(0);
+            $table->integer('album')->nullable();
+            $table->string('tag', 1024)->nullable();
+            $table->string('summary', 1024)->nullable();
+            $table->bigInteger('create_time');
+            $table->bigInteger('update_time');
+
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('res_indices');
+    }
+};

+ 48 - 0
api-v12/database/migrations/2021_12_28_222244_create_pali_texts_table.php

@@ -0,0 +1,48 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class  extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('pali_texts', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->integer('level');
+            $table->string('class', 255);
+            $table->text('toc');
+            $table->text('text');
+            $table->text('html');
+            $table->integer('lenght')->nullable();
+            $table->integer('album_index')->nullable();
+            $table->integer('chapter_len')->nullable();
+            $table->integer('next_chapter')->nullable();
+            $table->integer('prev_chapter')->nullable();
+            $table->integer('parent')->nullable();
+            $table->integer('chapter_strlen')->nullable();
+
+            $table->timestamps();
+
+            $table->index(['book', 'paragraph']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('pali_texts');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2021_12_28_223422_create_book_words_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('book_words', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('wordindex')->index();
+            $table->integer('count');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('book_words');
+    }
+};

+ 35 - 0
api-v12/database/migrations/2021_12_28_223702_create_book_titles_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('book_titles', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('paragraph')->index();
+            $table->string('title', 1024);
+            $table->timestamps();
+            $table->unique(["book", "paragraph"]);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('book_titles');
+    }
+};

+ 39 - 0
api-v12/database/migrations/2021_12_29_020248_create_word_lists_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('word_lists', function (Blueprint $table) {
+            $table->id();
+            $table->integer('sn')->unique();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->integer('wordindex')->index();
+            $table->integer('bold')->default(0);
+            $table->integer('weight')->default(1);
+            $table->timestamps();
+
+            $table->index(["book", "paragraph"]);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('word_lists');
+    }
+};

+ 39 - 0
api-v12/database/migrations/2021_12_29_021525_create_word_indices_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('word_indices', function (Blueprint $table) {
+            $table->integer('id')->primary();
+            $table->string('word', 1024)->unique();
+            $table->string('word_en', 1024)->index();
+            $table->integer('count')->default(0);
+            $table->integer('normal')->default(0);
+            $table->integer('bold')->default(0);
+            $table->integer('is_base')->default(0);
+            $table->integer('len')->default(0);
+            $table->integer('final')->default(0);
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('word_indices');
+    }
+};

+ 39 - 0
api-v12/database/migrations/2021_12_29_022234_create_bolds_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('bolds', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->string('word', 1024)->index();
+            $table->string('word2', 1024);
+            $table->string('word_en', 1024)->index();
+            $table->text('pali');
+            $table->text('base');
+            $table->timestamp('created_at')->useCurrent();
+            $table->index(['book', 'paragraph']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('bolds');
+    }
+};

+ 39 - 0
api-v12/database/migrations/2021_12_29_022844_create_word_statistics_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('word_statistics', function (Blueprint $table) {
+            $table->id();
+            $table->integer('bookid')->index();
+            $table->string('word', 1024)->index();
+            $table->integer('count');
+            $table->string('base', 1024)->index();
+            $table->string('end1', 256)->index();
+            $table->string('end2', 256)->index();
+            $table->integer('type');
+            $table->integer('length');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('word_statistics');
+    }
+};

+ 44 - 0
api-v12/database/migrations/2021_12_29_023712_create_pali_sentences_table.php

@@ -0,0 +1,44 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('pali_sentences', function (Blueprint $table) {
+            $table->integer('id')->primary();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->integer('word_begin');
+            $table->integer('word_end');
+            $table->integer('length');
+            $table->integer('count');
+            $table->text('text');
+            $table->text('html');
+            $table->text('sim_sents')->nullable();
+            $table->text('sim_sents_count')->default(0);
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+
+            $table->index(['book', 'paragraph', 'word_begin', 'word_end']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('pali_sentences');
+    }
+};

+ 45 - 0
api-v12/database/migrations/2021_12_29_025006_create_pali_sent_orgs_table.php

@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('pali_sent_orgs', function (Blueprint $table) {
+            $table->integer('id')->primary();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->integer('word_begin');
+            $table->integer('word_end');
+            $table->integer('length');
+            $table->integer('count');
+            $table->text('text');
+            $table->text('html');
+            $table->integer('merge')->default(1);
+            $table->text('sim_sents')->nullable();
+            $table->text('sim_sents_count')->default(0);
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+
+            $table->index(['book', 'paragraph', 'word_begin', 'word_end']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('pali_sent_orgs');
+    }
+};

+ 37 - 0
api-v12/database/migrations/2021_12_29_025311_create_pali_sent_indices_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('pali_sent_indices', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('para');
+            $table->integer('strlen');
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+
+            $table->index(['book', 'para']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('pali_sent_indices');
+    }
+};

+ 35 - 0
api-v12/database/migrations/2021_12_29_030034_create_sent_sims_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('sent_sims', function (Blueprint $table) {
+            $table->id();
+            $table->integer('sent1')->index();
+            $table->integer('sent2');
+            $table->float('sim');
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('sent_sims');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2021_12_29_030248_create_sent_sim_indices_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('sent_sim_indices', function (Blueprint $table) {
+            $table->id();
+            $table->integer('sent_id')->index();
+            $table->integer('count');
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('sent_sim_indices');
+    }
+};

+ 40 - 0
api-v12/database/migrations/2021_12_29_050502_create_progress_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('progress', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('para');
+            $table->string('lang', 16);
+            $table->integer('all_strlen');
+            $table->integer('public_strlen');
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+
+            $table->index(['book', 'para']);
+            $table->index(['book', 'para', 'lang']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('progress');
+    }
+};

+ 37 - 0
api-v12/database/migrations/2021_12_29_051305_create_progress_chapters_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('progress_chapters', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('para');
+            $table->string('lang', 16);
+            $table->float('all_trans');
+            $table->float('public');
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('progress_chapters');
+    }
+};

+ 40 - 0
api-v12/database/migrations/2021_12_29_051725_create_fts_texts_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+
+        Schema::create('fts_texts', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->string('wid', 64);
+            $table->text('bold_single');
+            $table->text('bold_double');
+            $table->text('bold_multiple');
+            $table->text('content');
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('fts_texts');
+    }
+};

+ 104 - 0
api-v12/database/migrations/2021_12_30_053602_add_func_to_fts_texts_table.php

@@ -0,0 +1,104 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('fts_texts', function (Blueprint $table) {
+            //
+        });
+
+        $sql = 'CREATE TEXT SEARCH CONFIGURATION pali ( parser = pg_catalog.default );';
+        DB::connection()->getPdo()->exec($sql);
+
+        $sql = 'CREATE TEXT SEARCH CONFIGURATION pali_unaccent ( parser = pg_catalog.default );';
+        DB::connection()->getPdo()->exec($sql);
+
+        $sql = 'CREATE TEXT SEARCH DICTIONARY pali_stem ( TEMPLATE = synonym, SYNONYMS = pali );';
+        DB::connection()->getPdo()->exec($sql);
+
+        $sql = ' CREATE TEXT SEARCH DICTIONARY pali_stopwords ( TEMPLATE = pg_catalog.simple, STOPWORDS = pali, ACCEPT = true);';
+        DB::connection()->getPdo()->exec($sql);
+
+        $sql = '
+ALTER TEXT SEARCH CONFIGURATION pali
+ADD MAPPING FOR asciiword, word, hword_part, hword_asciipart
+WITH pali_stem, pali_stopwords;';
+        DB::connection()->getPdo()->exec($sql);
+
+        $sql = '
+CREATE EXTENSION IF NOT EXISTS "unaccent";
+ALTER TEXT SEARCH CONFIGURATION pali_unaccent
+ADD MAPPING FOR asciiword, word, hword_part, hword_asciipart
+WITH unaccent, pali_stem, pali_stopwords;';
+        DB::connection()->getPdo()->exec($sql);
+
+
+        $sql = "ALTER TABLE fts_texts
+ADD COLUMN full_text_search_weighted TSVECTOR
+GENERATED ALWAYS AS (
+   setweight(to_tsvector('pali', coalesce(content,'')), 'A')  || ' ' ||
+   setweight(to_tsvector('pali', coalesce(bold_single,'')), 'B') || ' '  ||
+   setweight(to_tsvector('pali', coalesce(bold_double,'')), 'C') || ' ' ||
+   setweight(to_tsvector('pali', coalesce(bold_multiple,'')), 'D')
+) STORED;
+";
+        DB::connection()->getPdo()->exec($sql);
+
+        $sql = "
+ALTER TABLE fts_texts
+ADD COLUMN full_text_search_weighted_unaccent TSVECTOR
+GENERATED ALWAYS AS (
+setweight(to_tsvector('pali_unaccent', coalesce(content,'')), 'A')  || ' ' ||
+setweight(to_tsvector('pali_unaccent', coalesce(bold_single,'')), 'B') || ' '  ||
+setweight(to_tsvector('pali_unaccent', coalesce(bold_double,'')), 'C') || ' ' ||
+setweight(to_tsvector('pali_unaccent', coalesce(bold_multiple,'')), 'D')
+) STORED;";
+        DB::connection()->getPdo()->exec($sql);
+
+        $sql = "CREATE INDEX full_text_search_weighted_idx ON fts_texts USING GIN (full_text_search_weighted);";
+        DB::connection()->getPdo()->exec($sql);
+
+        $sql = "CREATE INDEX full_text_search_weighted__unaccent_idx ON fts_texts USING GIN (full_text_search_weighted_unaccent);";
+        DB::connection()->getPdo()->exec($sql);
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('fts_texts', function (Blueprint $table) {
+            //
+        });
+
+        # 删除全文检索配置 pali
+        $sql = 'DROP TEXT SEARCH CONFIGURATION  pali ;';
+        DB::connection()->getPdo()->exec($sql);
+
+        # 删除全文检索配置 pali_unaccent 无标音符号版
+        $sql = 'DROP TEXT SEARCH CONFIGURATION pali_unaccent ;';
+        DB::connection()->getPdo()->exec($sql);
+
+
+        # 删除巴利语词形转换字典
+        $sql = 'DROP TEXT SEARCH DICTIONARY pali_stem ;';
+        DB::connection()->getPdo()->exec($sql);
+
+        # 删除巴利语停用词字典
+        $sql = 'DROP TEXT SEARCH DICTIONARY pali_stopwords ;';
+        DB::connection()->getPdo()->exec($sql);
+    }
+};

+ 51 - 0
api-v12/database/migrations/2022_01_19_090727_create_wbws_table.php

@@ -0,0 +1,51 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('wbws', function (Blueprint $table) {
+            $table->bigInteger('id')->primary();
+            $table->string('uid', 36)->uniqid()->index();
+            $table->string('block_uid', 36)->nullable()->index();
+            $table->bigInteger('block_id')->nullable()->index();
+            $table->bigInteger('channel_id')->nullable()->index();
+            $table->integer('book_id');
+            $table->integer('paragraph');
+            $table->bigInteger('wid');
+            $table->string("word", 1024);
+            $table->text("data")->default('');
+            $table->integer('status')->default(10);
+            $table->string('creator_uid', 36);
+            $table->bigInteger('editor_id');
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+
+            $table->index(['book_id', 'paragraph', 'wid']);
+            $table->index(['book_id', 'paragraph']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('wbws');
+    }
+};

+ 62 - 0
api-v12/database/migrations/2022_01_19_110604_create_wbw_blocks_table.php

@@ -0,0 +1,62 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        /*
+
+
+
+
+    style VARCHAR (16),
+    lang VARCHAR (16)  NOT NULL,
+    status INTEGER  NOT NULL,
+		*/
+        Schema::create('wbw_blocks', function (Blueprint $table) {
+            $table->bigInteger('id')->primary();
+            $table->string('uid', 36)->uniqid()->index();
+            $table->string('parent_id', 36)->nullable();
+            $table->string('block_uid', 36)->nullable()->index();
+            $table->bigInteger('block_id')->nullable()->index();
+            $table->bigInteger('channel_id')->nullable()->index();
+            $table->string('channel_uid', 36)->nullable()->index();
+            $table->string('parent_channel_uid', 36)->nullable();
+            $table->string('creator_uid', 36);
+            $table->bigInteger('editor_id');
+            $table->integer('book_id');
+            $table->integer('paragraph');
+            $table->string('style', 16)->nullable();
+            $table->string("lang", 16);
+            $table->integer('status')->default(10);
+
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+
+            $table->index(['book_id', 'paragraph']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('wbw_blocks');
+    }
+};

+ 46 - 0
api-v12/database/migrations/2022_01_20_135745_create_channels_table.php

@@ -0,0 +1,46 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('channels', function (Blueprint $table) {
+            $table->bigInteger('id')->primary();
+            $table->string('uid', 36)->uniqid()->index();
+            $table->enum('type', ['original', 'translation', 'nissaya', 'commentary'])->default('translation');
+            $table->string('owner_uid', 36);
+            $table->bigInteger('editor_id');
+            $table->string('name', 128)->index();
+            $table->string('summary', 1024)->nullable();
+            $table->string('lang', 16);
+            $table->integer('status')->default(10);
+            $table->text('setting')->nullable();
+
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('channels');
+    }
+};

+ 59 - 0
api-v12/database/migrations/2022_01_22_152901_create_sentences_table.php

@@ -0,0 +1,59 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('sentences', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('uid', 36)->uniqid()->index();
+            $table->string('parent_uid', 36)->nullable()->index();
+            $table->string('block_uid', 36)->nullable()->index();
+            $table->string('channel_uid', 36)->nullable()->index();
+            $table->integer('book_id');
+            $table->integer('paragraph');
+            $table->integer('word_start');
+            $table->integer('word_end');
+            $table->string('author', 512)->nullable();
+
+            $table->string('editor_uid', 36);
+            $table->text('content')->nullable();
+            $table->enum('content_type', ['markdown', 'text', 'html'])->default('markdown');
+            $table->string('language', 16);
+            $table->integer('version')->default(1);
+            $table->integer('strlen');
+            $table->integer('status')->default(10);
+
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+
+            $table->index(['book_id', 'paragraph', 'word_start', 'word_end']);
+            $table->index(['book_id', 'paragraph', 'word_start', 'word_end', 'channel_uid']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('sentences');
+    }
+};

+ 72 - 0
api-v12/database/migrations/2022_01_27_130346_create_sent_blocks_table.php

@@ -0,0 +1,72 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    /*
+     CREATE TABLE sent_blocks
+(
+    id SERIAL PRIMARY KEY,
+	uid VARCHAR (36),
+	parent_uid VARCHAR (36),
+	book_id INTEGER,
+	paragraph INTEGER,
+	owner_uid VARCHAR (36),
+	lang VARCHAR (16),
+	author VARCHAR (50),
+	editor_uid VARCHAR (36),
+	status INTEGER NOT NULL DEFAULT (10),
+	modify_time BIGINT,
+	create_time BIGINT,
+	created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+	updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+	deleted_at TIMESTAMP
+);
+
+CREATE UNIQUE INDEX sent_blocks_uid ON sent_blocks (uid);
+CREATE INDEX sent_blocks_book_para ON sent_blocks (book_id,paragraph);
+     */
+    public function up(): void
+    {
+        Schema::create('sent_blocks', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+            $table->string('uid', 36)->uniqid()->index();
+            $table->string('parent_uid', 36)->nullable()->index();
+            $table->integer('book_id');
+            $table->integer('paragraph');
+            $table->string('owner_uid', 36);
+            $table->string('editor_uid', 36);
+            $table->string('lang', 16);
+            $table->string('author', 64);
+            $table->integer('status')->default(10);
+
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+
+            $table->index(['book_id', 'paragraph']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('sent_blocks');
+    }
+};

+ 57 - 0
api-v12/database/migrations/2022_01_27_132319_create_sent_prs_table.php

@@ -0,0 +1,57 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+
+    public function up(): void
+    {
+        Schema::create('sent_prs', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+            //用作数据迁移时的相同数据比对
+            $table->integer('old_id')->nullable();
+
+            $table->integer('book_id');
+            $table->integer('paragraph');
+            $table->integer('word_start');
+            $table->integer('word_end');
+            $table->string('channel_uid', 36);
+
+            $table->string('author', 512)->nullable();
+            $table->string('editor_uid', 36);
+
+            $table->text('content');
+            $table->string('language', 16);
+            $table->integer('status')->default(10);
+            $table->integer('strlen')->default(0);
+
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+
+            $table->index(['book_id', 'paragraph', 'word_start', 'word_end', 'channel_uid']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('sent_prs');
+    }
+};

+ 47 - 0
api-v12/database/migrations/2022_01_27_133456_create_sent_histories_table.php

@@ -0,0 +1,47 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    /*
+         id SERIAL PRIMARY KEY,
+	sent_uid VARCHAR (36),
+	user_uid VARCHAR (36),
+	content TEXT,
+	landmark VARCHAR (64),
+	date BIGINT,
+	created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+     */
+    public function up(): void
+    {
+        Schema::create('sent_histories', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+            $table->string('sent_uid', 36)->index();
+            $table->string('user_uid', 36);
+            $table->text('content');
+            $table->string('landmark', 64)->nullable();
+
+            $table->bigInteger('create_time')->index();
+            $table->timestamp('created_at')->useCurrent();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('sent_histories');
+    }
+};

+ 56 - 0
api-v12/database/migrations/2022_01_28_081954_create_user_dicts_table.php

@@ -0,0 +1,56 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('user_dicts', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('word', 1024)->index();
+            $table->string('type', 128)->nullable();
+            $table->string('grammar', 128)->nullable();
+            $table->string('parent', 1024)->nullable();
+            $table->text('mean')->nullable();
+            $table->text('note')->nullable();
+            $table->string('factors', 1024)->nullable();
+            $table->string('factormean', 1024)->nullable();
+            $table->integer('status')->default(10);
+            $table->string('source', 1024)->nullable();
+
+            $table->string('language', 16)->default('en-US');
+            $table->integer('confidence')->default(100);
+            $table->integer('exp')->default(0);
+            $table->bigInteger('creator_id')->index();
+            $table->bigInteger('ref_counter')->default(1);
+
+            $table->bigInteger('create_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+
+            $table->index(['word', 'creator_id']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('user_dicts');
+    }
+};

+ 38 - 0
api-v12/database/migrations/2022_01_28_092534_create_user_operation_dailies_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('user_operation_dailies', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+            $table->bigInteger('user_id')->index();
+            $table->bigInteger('date_int')->index();
+            $table->bigInteger('duration');
+            $table->integer('hit')->default(1);
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('user_operation_dailies');
+    }
+};

+ 40 - 0
api-v12/database/migrations/2022_01_28_102330_create_user_operation_frames_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('user_operation_frames', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+            $table->bigInteger('user_id')->index();
+            $table->bigInteger('duration');
+            $table->integer('hit')->default(1);
+            $table->bigInteger('timezone')->default(0);
+            $table->bigInteger('op_start');
+            $table->bigInteger('op_end');
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('user_operation_frames');
+    }
+};

+ 56 - 0
api-v12/database/migrations/2022_01_28_105209_create_user_operation_logs_table.php

@@ -0,0 +1,56 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('user_operation_logs', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+            $table->bigInteger('user_id')->index();
+            $table->bigInteger('op_type_id')->index();
+            $table->enum('op_type', [
+                'channel_update',
+                'channel_create',
+                'article_update',
+                'article_create',
+                'dict_lookup',
+                'term_create',
+                'term_update',
+                'term_lookup',
+                'wbw_update',
+                'wbw_create',
+                'sent_update',
+                'sent_create',
+                'collection_update',
+                'collection_create',
+                'nissaya_open'
+            ]);
+            $table->text('content')->nullable();
+            $table->bigInteger('timezone')->default(0);
+            $table->bigInteger('create_time');
+            $table->timestamp('created_at')->useCurrent();
+
+            $table->index(['user_id', 'op_type_id']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('user_operation_logs');
+    }
+};

+ 54 - 0
api-v12/database/migrations/2022_01_28_121154_create_articles_table.php

@@ -0,0 +1,54 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('articles', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('uid', 36)->uniqid()->index();
+            $table->bigInteger('parent_id')->nullable()->index();
+            $table->bigInteger('default_channel_id')->nullable()->index();
+            $table->string('title', 128)->index();
+            $table->string('subtitle', 128)->nullable();
+            $table->string('summary', 1024)->nullable();
+            $table->text('cover')->nullable();
+            $table->text('content')->nullable();
+            $table->enum('content_type', ['markdown', 'text', 'html'])->default('markdown');
+            $table->string('owner', 36)->index();
+            $table->bigInteger('owner_id')->index();
+            $table->bigInteger('editor_id')->index();
+            $table->text('setting')->nullable();
+            $table->integer('status')->default(10)->index();
+            $table->string('lang', 16)->default('none')->index();
+
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('articles');
+    }
+};

+ 53 - 0
api-v12/database/migrations/2022_01_28_123829_create_collections_table.php

@@ -0,0 +1,53 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('collections', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('uid', 36)->uniqid()->index();
+            $table->bigInteger('parent_id')->nullable()->index();
+            $table->bigInteger('default_channel_id')->nullable()->index();
+            $table->string('title', 128)->index();
+            $table->string('subtitle', 128)->nullable();
+            $table->string('summary', 1024)->nullable();
+            $table->text('cover')->nullable();
+            $table->text('article_list')->nullable();
+            $table->string('owner', 36)->index();
+            $table->bigInteger('owner_id')->index();
+            $table->bigInteger('editor_id')->index();
+            $table->text('setting')->nullable();
+            $table->integer('status')->default(10)->index();
+            $table->string('lang', 16)->default('none')->index();
+
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+            $table->timestamp('deleted_at')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('collections');
+    }
+};

+ 41 - 0
api-v12/database/migrations/2022_01_28_124816_create_article_collections_table.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('article_collections', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('collect_id', 36)->index();
+            $table->string('article_id', 36)->index();
+            $table->integer('level');
+            $table->string('title', 128)->nullable()->index();
+            $table->integer('children')->default(0);
+            $table->bigInteger('editor_id')->default(0);
+
+            $table->timestamp('created_at')->useCurrent();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('article_collections');
+    }
+};

+ 50 - 0
api-v12/database/migrations/2022_02_02_103531_create_dhamma_terms_table.php

@@ -0,0 +1,50 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('dhamma_terms', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+            $table->string('guid', 36)->uniqid();
+
+            $table->string('word', 1024)->index();
+            $table->string('word_en', 1024)->index();
+            $table->string('meaning', 1024)->index();
+            $table->string('other_meaning', 1024)->nullable();
+            $table->text('note', 1024)->nullable();
+            $table->string('tag', 1024)->nullable();
+            $table->string('channal', 36)->index()->nullable();
+            $table->string('language', 16)->default('zh-hans');
+            $table->string('owner', 36)->index();
+            $table->bigInteger('editor_id')->index();
+
+            $table->bigInteger('create_time');
+            $table->bigInteger('modify_time');
+
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+            $table->timestamp('deleted_at')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('dhamma_terms');
+    }
+};

+ 47 - 0
api-v12/database/migrations/2022_02_04_012828_create_shares_table.php

@@ -0,0 +1,47 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('shares', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('res_id', 36);
+            $table->integer('res_type');
+            $table->string('cooperator_id', 36);
+            $table->integer('cooperator_type');
+            $table->integer('power');
+            $table->bigInteger('create_time');
+            $table->bigInteger('modify_time');
+
+            $table->timestamp('accepted_at')->nullable()->index();
+            $table->bigInteger('acceptor')->nullable();
+
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+
+            $table->unique(['res_id', 'res_type', 'cooperator_id', 'cooperator_type']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('shares');
+    }
+};

+ 41 - 0
api-v12/database/migrations/2022_02_05_020339_create_group_infos_table.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('group_infos', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('uid', 36)->uniqid()->index();
+            $table->string('name', 64)->uniqid()->index();
+            $table->string('description', 1024)->nullable();
+            $table->integer('status')->default(30);
+            $table->string('owner', 36)->index();
+            $table->bigInteger('create_time');
+            $table->bigInteger('modify_time');
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('group_infos');
+    }
+};

+ 43 - 0
api-v12/database/migrations/2022_02_05_024244_create_group_members_table.php

@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('group_members', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('user_id', 36)->index();
+            $table->string('group_id', 36)->index();
+            $table->string('group_name', 64)->nullable();
+
+            $table->integer('power')->default(1);
+            $table->integer('level')->default(0);
+            $table->integer('status')->default(1)->index();
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+
+            $table->unique(['user_id', 'group_id']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('group_members');
+    }
+};

+ 57 - 0
api-v12/database/migrations/2022_02_06_075148_create_file_indices_table.php

@@ -0,0 +1,57 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('file_indices', function (Blueprint $table) {
+            #使用雪花id
+            $table->bigInteger('id')->primary();
+
+            $table->string('uid', 36)->uniqid();
+            $table->string('parent_id', 36)->nullable()->index();
+            $table->bigInteger('user_id')->index();
+            $table->integer('book');
+            $table->integer('paragraph');
+            $table->string('channal', 36)->nullable()->index();
+            $table->string('file_name', 128)->nullable()->index();
+            $table->string('title', 128)->index();
+            $table->string('tag', 512)->nullable()->index();
+            $table->integer('status')->default(1);
+            $table->integer('file_size')->nullable();
+            $table->integer('share')->default(0);
+            $table->text('doc_info');
+            $table->text('doc_block');
+
+            $table->bigInteger('create_time');
+            $table->bigInteger('modify_time');
+            $table->bigInteger('accese_time');
+
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('accesed_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+            $table->timestamp('deleted_at')->nullable();
+
+            $table->index(['book', 'paragraph']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('file_indices');
+    }
+};

+ 59 - 0
api-v12/database/migrations/2022_02_07_012707_create_wbw_analyses_table.php

@@ -0,0 +1,59 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+
+     * @return void
+     */
+    /*
+     'userid',
+                            'pali',
+                            'book',
+                            'paragraph',
+                            'wid',
+                            'type',
+                            'data',
+                            'confidence',
+                            'lang',
+                            'modify_time')
+     */
+    public function up(): void
+    {
+        Schema::create('wbw_analyses', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('wbw_id')->index();
+            $table->string('wbw_word', 1024);
+            $table->integer('book_id');
+            $table->integer('paragraph');
+            $table->integer('wid');
+            $table->integer('type');
+            $table->text('data')->index();
+            $table->integer('confidence');
+            $table->string('lang', 16);
+            $table->text('d1')->nullable()->index(); //备用数据
+            $table->text('d2')->nullable()->index(); //备用数据
+            $table->text('d3')->nullable()->index(); //备用数据
+            $table->bigInteger('editor_id');
+            $table->timestamps();
+
+            $table->index(['type', 'data']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('wbw_analyses');
+    }
+};

+ 39 - 0
api-v12/database/migrations/2022_02_11_090826_create_custom_books_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('custom_books', function (Blueprint $table) {
+            $table->bigInteger('id')->primary();
+            $table->integer('book_id')->uniqid();
+            $table->string('title', 512)->index();
+            $table->string('owner', 36)->index();
+            $table->bigInteger('editor_id')->index();
+            $table->string('lang', 16);
+            $table->integer('status');
+
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('custom_books');
+    }
+};

+ 49 - 0
api-v12/database/migrations/2022_02_13_024642_create_custom_book_sentences_table.php

@@ -0,0 +1,49 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('custom_book_sentences', function (Blueprint $table) {
+            $table->bigInteger('id')->primary();
+
+            $table->integer('book')->index();
+            $table->integer('paragraph');
+            $table->integer('word_start');
+            $table->integer('word_end');
+            $table->text('content');
+            $table->enum('content_type', ['markdown', 'text', 'html'])->default('markdown');
+            $table->integer('length');
+            $table->string('owner', 36)->index();
+            $table->string('lang', 16);
+            $table->integer('status')->default(10);
+
+            $table->bigInteger('create_time')->index();
+            $table->bigInteger('modify_time')->index();
+
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+
+            $table->index(['book', 'paragraph', 'word_start', 'word_end']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('custom_book_sentences');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2022_02_14_094254_create_custom_book_ids_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('custom_book_ids', function (Blueprint $table) {
+            $table->id();
+            $table->string('key', 32)->default('max_book_number');
+            $table->integer('value');
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('custom_book_ids');
+    }
+};

+ 38 - 0
api-v12/database/migrations/2022_02_27_103552_add_channel_to_progress_chapter.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('progress_chapters', function (Blueprint $table) {
+            //
+            $table->uuid('channel_id')->index();
+            $table->float('progress');
+            $table->string('title', 256)->nullable()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('progress_chapters', function (Blueprint $table) {
+            //
+            $table->dropColumn('channel_id');
+            $table->dropColumn('progress');
+            $table->dropColumn('title');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2022_02_27_151744_add_channel_to_progress.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('progress', function (Blueprint $table) {
+            //
+            $table->uuid('channel_id')->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('progress', function (Blueprint $table) {
+            //
+            $table->dropColumn('channel_id');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2022_05_20_144400_add_path_into_pali_texts.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        //
+        Schema::table('pali_texts', function (Blueprint $table) {
+            $table->json('path')->after('parent')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        //
+        Schema::table('pali_texts', function (Blueprint $table) {
+            $table->dropColumn('path');
+        });
+    }
+};

+ 39 - 0
api-v12/database/migrations/2022_05_22_142016_create_tags_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        DB::statement('CREATE EXTENSION IF NOT EXISTS "uuid-ossp";');
+        Schema::create('tags', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('name', 32)->index();
+            $table->string('description', 256)->nullable();
+            $table->integer('color')->default(0xa1a1a1);
+            $table->uuid('owner_id')->index();
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('tags');
+        DB::statement('DROP EXTENSION IF EXISTS "uuid-ossp";');
+    }
+};

+ 38 - 0
api-v12/database/migrations/2022_05_22_143716_create_tag_maps_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('tag_maps', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('table_name', '128');
+            $table->uuid('anchor_id')->index();
+            $table->uuid('tag_id')->index();
+            $table->timestamp('created_at')->useCurrent()->index();
+            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+
+            $table->unique(['table_name', 'anchor_id', 'tag_id']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('tag_maps');
+    }
+};

+ 35 - 0
api-v12/database/migrations/2022_05_23_010426_use_uuid_in_pali_texts.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('pali_texts', function (Blueprint $table) {
+            //
+            $table->uuid('uid')->unique()->default(DB::raw('uuid_generate_v1mc()'));
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('pali_texts', function (Blueprint $table) {
+            //
+            $table->dropColumn('uid');
+        });
+    }
+};

+ 35 - 0
api-v12/database/migrations/2022_05_23_070112_add_uuid_in_progress_chapters.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('progress_chapters', function (Blueprint $table) {
+            //
+            $table->uuid('uid')->unique()->default(DB::raw('uuid_generate_v1mc()'));
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('progress_chapters', function (Blueprint $table) {
+            //
+            $table->dropColumn('uid');
+        });
+    }
+};

+ 35 - 0
api-v12/database/migrations/2022_05_25_054449_add_uuid_in_channels.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            $table->uuid('uuid')->default(DB::raw('uuid_generate_v1mc()'));
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            $table->dropColumn('uuid');
+        });
+    }
+};

+ 58 - 0
api-v12/database/migrations/2022_05_25_075215_rename_uuid_to_uid_in_channels.php

@@ -0,0 +1,58 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+        });
+
+        DB::transaction(function () {
+            $sql = 'UPDATE channels SET uuid = uuid(uid);';
+            DB::select($sql);
+            $sql = "ALTER TABLE channels DROP COLUMN uid;";
+            DB::select($sql);
+            $sql = "DROP INDEX IF EXISTS channels_uid_unique ;";
+            DB::select($sql);
+            $sql = "DROP INDEX IF EXISTS channels_uuid_unique ;";
+            DB::select($sql);
+            $sql = "ALTER TABLE channels RENAME COLUMN uuid TO uid;";
+            DB::select($sql);
+            $sql = "CREATE UNIQUE INDEX IF NOT EXISTS channels_uid_unique ON channels (uid);";
+            DB::select($sql);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            //$table->uuid('uuid')->default(DB::raw('uuid_generate_v1mc()'));
+
+        });
+        DB::transaction(function () {
+            $sql = "ALTER TABLE public.channels ADD uuid uuid NOT NULL DEFAULT uuid_generate_v1mc();";
+            DB::select($sql);
+            $sql = "CREATE UNIQUE INDEX IF NOT EXISTS channels_uuid_unique ON channels (uuid);";
+            DB::select($sql);
+            $sql = 'UPDATE channels SET uuid = uuid(uid);';
+            DB::select($sql);
+        });
+    }
+};

+ 36 - 0
api-v12/database/migrations/2022_05_27_072344_create_views_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     * 点击量统计
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('views', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->uuid('target_id')->index();
+            $table->string('target_type', 32)->index();
+            $table->uuid('user_id')->index()->nullable();
+            $table->ipAddress('user_ip')->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('views');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2022_05_28_120007_add_summary_in_progress_chapters.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('progress_chapters', function (Blueprint $table) {
+            //
+            $table->string('summary', 256)->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('progress_chapters', function (Blueprint $table) {
+            //
+            $table->dropColumn('summary');
+        });
+    }
+};

+ 46 - 0
api-v12/database/migrations/2022_05_29_103822_create_likes_table.php

@@ -0,0 +1,46 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    /*
+
+    点赞 like
+    关注 watch
+    收藏 favorite
+    书签 bookmark
+     */
+    public function up(): void
+    {
+        Schema::create('likes', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('type', 32)->index();
+            $table->uuid('target_id')->index();
+            $table->string('target_type', 32)->index();
+            $table->string('context', 128)->nullable();
+            $table->uuid('user_id')->index();
+            $table->timestamps();
+
+            $table->unique(['type', 'target_id', 'user_id']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('likes');
+    }
+};

+ 40 - 0
api-v12/database/migrations/2022_06_03_021251_create_user_experiences_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('user_experiences', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->uuid('user_id');
+            $table->date('date'); //统计日期
+            $table->integer('user_exp')->default(0); //总分
+            $table->integer('user_level')->default(1); //等级 1-60
+            $table->integer('edit_exp')->default(0); //编辑总时长 小时
+            $table->integer('wbw_count')->default(0); //逐词译个数
+            $table->integer('wbw_edit')->default(0); //逐词译编辑次数
+            $table->integer('trans_character')->default(0); //译文字符数
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('user_experiences');
+    }
+};

+ 40 - 0
api-v12/database/migrations/2022_06_18_134823_add_title_in_views.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('views', function (Blueprint $table) {
+            //
+            $table->string('title', 256)->nullable()->index();
+            $table->string('org_title', 256)->nullable()->index();
+            $table->integer('count')->default(0);
+            $table->json('meta')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('views', function (Blueprint $table) {
+            //
+            $table->dropColumn('title');
+            $table->dropColumn('org_title');
+            $table->dropColumn('count');
+            $table->dropColumn('meta');
+        });
+    }
+};

+ 40 - 0
api-v12/database/migrations/2022_08_11_064121_create_dict_infos_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('dict_infos', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('name', 256)->index();
+            $table->string('shortname', 16)->index();
+            $table->string('description', 1024)->nullable();
+            $table->string('src_lang', 16)->index()->default('pa');
+            $table->string('dest_lang', 16)->index()->default('en');
+            $table->integer('rows')->default(0);
+            $table->uuid('owner_id');
+            $table->json('meta');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('dict_infos');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2022_08_11_095714_add_dictid_in_user_dicts.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->uuid('dict_id')->nullable()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->dropColumn('dict_id');
+        });
+    }
+};

+ 33 - 0
api-v12/database/migrations/2022_08_12_134209_create_word_parts_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('word_parts', function (Blueprint $table) {
+            $table->id();
+            $table->string('word', 1024)->unique();
+            $table->bigInteger('weight');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('word_parts');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2022_08_14_131951_add_realindex_in_wbw_templates.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('wbw_templates', function (Blueprint $table) {
+            //
+            $table->index(['real']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('wbw_templates', function (Blueprint $table) {
+            //
+            $table->dropIndex('wbw_templates_real_index');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2022_08_14_133812_add_sourceindex_in_user_dicts.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->index(['source']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->dropIndex('user_dicts_source_index');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2022_08_14_140946_add_flag_in_user_dicts.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->integer('flag')->default(0)->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->dropColumn('flag');
+        });
+    }
+};

+ 40 - 0
api-v12/database/migrations/2022_12_19_125601_create_discussions_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('discussions', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->uuid('res_id')->index();
+            $table->string('res_type', 32)->index();
+            $table->uuid('parent')->index()->nullable();
+            $table->string('title', 256)->nullable();
+            $table->text('content')->nullable();
+            $table->integer('children_count')->default(0);
+            $table->uuid('editor_uid')->index();
+            $table->string('publicity', 32)->default('public');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('discussions');
+    }
+};

+ 41 - 0
api-v12/database/migrations/2022_12_29_125609_create_courses_table.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('courses', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('title', 256)->index();
+            $table->string('subtitle', 256)->nullable();
+            $table->string('cover', 256)->nullable();
+            $table->text('content')->nullable();
+            $table->enum('content_type', ['markdown', 'text', 'html'])->default('markdown');
+            $table->uuid('teacher')->nullable()->index();
+            $table->timestamp('start_at')->nullable()->index();
+            $table->timestamp('end_at')->nullable()->index();
+            $table->uuid('studio_id')->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('courses');
+    }
+};

+ 37 - 0
api-v12/database/migrations/2022_12_29_125646_create_course_members_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('course_members', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->uuid('user_id')->index();
+            $table->string('role', 32)->index();
+            $table->uuid('course_id')->index();
+            $table->uuid('channel_id')->nullable()->index();
+            $table->string('status', 32)->default('normal')->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('course_members');
+    }
+};

+ 38 - 0
api-v12/database/migrations/2023_01_24_131456_add_anthology_in_courses.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('courses', function (Blueprint $table) {
+            //
+            $table->uuid('anthology_id')->nullable()->index();
+            $table->integer('publicity')->default(10)->index();
+            $table->uuid('channel_id')->nullable()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('courses', function (Blueprint $table) {
+            //
+            $table->dropColumn('anthology_id');
+            $table->dropColumn('publicity');
+            $table->dropColumn('channel_id');
+        });
+    }
+};

+ 38 - 0
api-v12/database/migrations/2023_02_02_135125_add_join_in_courses.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('courses', function (Blueprint $table) {
+            //
+            $table->string('join', 16)->default('invite')->index();
+            $table->string('request_exp', 16)->default('none')->index();
+            $table->string('summary', 256)->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('courses', function (Blueprint $table) {
+            //
+            $table->dropColumn('join');
+            $table->dropColumn('request_exp');
+            $table->dropColumn('summary');
+        });
+    }
+};

+ 35 - 0
api-v12/database/migrations/2023_02_10_052603_create_vocabularies_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('vocabularies', function (Blueprint $table) {
+            $table->id();
+            $table->string('word', 1024)->index();
+            $table->string('word_en', 1024)->index();
+            $table->integer('count');
+            $table->integer('flag')->default(0);
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('vocabularies');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_02_17_025306_change_confidence_in_user_dicts.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->float('confidence')->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->integer('confidence')->change();
+        });
+    }
+};

+ 36 - 0
api-v12/database/migrations/2023_02_19_122318_add_index_created_at_in_sentences.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('sentences', function (Blueprint $table) {
+            //
+            $table->index('created_at');
+            $table->index('updated_at');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('sentences', function (Blueprint $table) {
+            //
+            $table->dropIndex("sentences_created_at_index");
+            $table->dropIndex("sentences_updated_at_index");
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_02_25_124246_add_content_type_in_discussions.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('discussions', function (Blueprint $table) {
+            //
+            $table->enum('content_type', ['markdown', 'text', 'html'])->default('markdown');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('discussions', function (Blueprint $table) {
+            //
+            $table->dropColumn('content_type');
+        });
+    }
+};

+ 38 - 0
api-v12/database/migrations/2023_03_08_083306_add_accept_in_sentences.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('sentences', function (Blueprint $table) {
+            //
+            $table->dateTimeTz('pr_edit_at')->nullable()->index();
+            $table->uuid('acceptor_uid')->nullable()->index();
+            $table->bigInteger('pr_id')->nullable()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('sentences', function (Blueprint $table) {
+            //
+            $table->dropColumn('pr_edit_at');
+            $table->dropColumn('acceptor_uid');
+            $table->dropColumn('pr_id');
+        });
+    }
+};

+ 40 - 0
api-v12/database/migrations/2023_03_14_153653_create_nissaya_endings_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('nissaya_endings', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('ending', 256)->index();
+            $table->string('lang', 16)->index();
+            $table->string('relation', 32)->nullable()->index();
+            $table->string('case', 32)->nullable()->index();
+            $table->integer('strlen')->index()->default(0);
+            $table->integer('count')->index()->default(0);
+            $table->uuid('editor_id');
+            $table->timestamps();
+            $table->unique(["ending", "relation", "case"]);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('nissaya_endings');
+    }
+};

+ 37 - 0
api-v12/database/migrations/2023_03_14_153724_create_relations_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('relations', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('name', 256)->index();
+            $table->string('case', 16)->nullable()->index();
+            $table->json('to')->nullable();
+            $table->uuid('editor_id');
+            $table->timestamps();
+            $table->unique(["name", "case"]);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('relations');
+    }
+};

+ 39 - 0
api-v12/database/migrations/2023_03_27_021002_create_related_paragraphs_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('related_paragraphs', function (Blueprint $table) {
+            $table->id();
+            $table->integer('book')->index();
+            $table->integer('para')->index();
+            $table->integer('book_id');
+            $table->integer('cs_para');
+            $table->string('book_name', 64)->index();
+            $table->timestamps();
+            $table->index(['book', 'para', 'cs_para']);
+            $table->index(['book_name', 'cs_para']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('related_paragraphs');
+    }
+};

+ 33 - 0
api-v12/database/migrations/2023_03_29_132614_add_pcd_book_in_fts_texts.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('fts_texts', function (Blueprint $table) {
+            //
+            $table->integer('pcd_book_id')->index()->default(0);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('fts_texts', function (Blueprint $table) {
+            $table->dropColumn('pcd_book_id');
+        });
+    }
+};

+ 33 - 0
api-v12/database/migrations/2023_04_04_014330_add_book_id_in_wbw_templates.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('wbw_templates', function (Blueprint $table) {
+            //
+            $table->integer('pcd_book_id')->index()->default(0);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('wbw_templates', function (Blueprint $table) {
+            $table->dropColumn('pcd_book_id');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_04_04_142510_add_index_type_in_wbw_templates.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('wbw_templates', function (Blueprint $table) {
+            //
+            $table->index('type');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('wbw_templates', function (Blueprint $table) {
+            //
+            $table->dropIndex("wbw_templates_type_index");
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_04_05_132106_add_strlen_in_vocabularies.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('vocabularies', function (Blueprint $table) {
+            //
+            $table->integer('strlen')->index()->default(0);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('vocabularies', function (Blueprint $table) {
+            //
+            $table->dropColumn('strlen');
+        });
+    }
+};

+ 35 - 0
api-v12/database/migrations/2023_04_09_070539_add_deleted_at_article_collections.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        //
+        Schema::table('article_collections', function (Blueprint $table) {
+            $table->timestamp('deleted_at')->nullable()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        //
+        Schema::table('article_collections', function (Blueprint $table) {
+            //
+            $table->dropColumn('deleted_at');
+        });
+    }
+};

+ 47 - 0
api-v12/database/migrations/2023_05_17_125307_create_user_infos_table.php

@@ -0,0 +1,47 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('user_infos', function (Blueprint $table) {
+            $table->id();
+            $table->uuid('userid')->unique();
+            $table->uuid('path')->nullable();
+            $table->string('username', 64)->unique();
+            $table->string('password', 64);
+            $table->string('nickname', 64);
+            $table->string('email', 256)->unique();
+            $table->bigInteger('create_time')->nullable();
+            $table->bigInteger('modify_time')->nullable();
+            $table->bigInteger('receive_time')->nullable();
+            $table->text('setting')->nullable();
+            $table->text('reset_password_token')->nullable();
+            $table->timestamp('reset_password_sent_at')->nullable();
+            $table->text('confirmation_token')->nullable();
+            $table->timestamp('confirmed_at')->nullable();
+            $table->timestamp('confirmation_sent_at')->nullable();
+            $table->text('unconfirmed_email')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('user_infos');
+    }
+};

+ 41 - 0
api-v12/database/migrations/2023_06_10_005253_change_content_type_in_sentences.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('sentences', function (Blueprint $table) {
+            //
+            $table->string('content_type', 32)->default('markdown')->change();
+            $sql = "ALTER TABLE sentences DROP CONSTRAINT sentences_content_type_check";
+            DB::connection()->getPdo()->exec($sql);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('sentences', function (Blueprint $table) {
+            //
+            $sql = "ALTER TABLE sentences ADD CONSTRAINT sentences_content_type_check
+                        CHECK(content_type::text = ANY (ARRAY['markdown'::character varying::text,
+                        'text'::character varying::text,
+                        'html'::character varying::text]))";
+            DB::connection()->getPdo()->exec($sql);
+        });
+    }
+};

+ 40 - 0
api-v12/database/migrations/2023_06_15_021837_create_attachments_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('attachments', function (Blueprint $table) {
+            $table->uuid("id")->primary();
+            $table->uuid("user_uid")->index();
+            $table->string('bucket', 255)->index();
+            $table->string('name', 63)->index();
+            $table->string('title', 255)->index();
+            $table->bigInteger('size')->index();
+            $table->string('content_type', 63);
+            $table->string('status', 16)->index();
+            $table->integer('version')->default(0);
+            $table->timestamp('deleted_at')->nullable()->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('attachments');
+    }
+};

+ 37 - 0
api-v12/database/migrations/2023_07_02_110904_create_recents_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('recents', function (Blueprint $table) {
+            $table->uuid("id")->primary();
+            $table->string('type', 63)->index();
+            $table->string('article_id', 255)->index();
+            $table->json('param')->nullable();
+            $table->uuid("user_uid")->index();
+            $table->timestamps();
+            $table->index('created_at');
+            $table->index('updated_at');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('recents');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_07_10_111723_create_invites_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('invites', function (Blueprint $table) {
+            $table->uuid("id")->primary();
+            $table->uuid("user_uid")->index();
+            $table->string('email', 256)->unique();
+            $table->string('status', 63)->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('invites');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_07_18_015852_add_from_in_relations.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('relations', function (Blueprint $table) {
+            //
+            $table->json('from')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('relations', function (Blueprint $table) {
+            //
+            $table->dropColumn('from');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_07_21_023409_add_category_in_relations.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('relations', function (Blueprint $table) {
+            //
+            $table->string('category', 64)->nullable()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('relations', function (Blueprint $table) {
+            //
+            $table->dropColumn('category');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_07_21_122748_add_from_in_nissaya_endings.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('nissaya_endings', function (Blueprint $table) {
+            //
+            $table->json('from')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('nissaya_endings', function (Blueprint $table) {
+            //
+            $table->dropColumn('from');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_07_22_003004_add_match_in_relations.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('relations', function (Blueprint $table) {
+            //
+            $table->json('match')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('relations', function (Blueprint $table) {
+            //
+            $table->dropColumn('match');
+        });
+    }
+};

+ 36 - 0
api-v12/database/migrations/2023_07_29_132052_add_index_created_at_in_user_dicts.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->index('created_at');
+            $table->index('updated_at');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('user_dicts', function (Blueprint $table) {
+            //
+            $table->dropIndex("user_dicts_created_at_index");
+            $table->dropIndex("user_dicts_updated_at_index");
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_08_06_125849_add_config_in_channels.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            $table->json('config')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            $table->dropColumn('config');
+        });
+    }
+};

+ 40 - 0
api-v12/database/migrations/2023_08_07_113207_create_web_hooks_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::create('web_hooks', function (Blueprint $table) {
+            $table->uuid("id")->primary();
+            $table->string('res_type', 32)->index();
+            $table->uuid('res_id')->index();
+            $table->string('url', 512)->index();
+            $table->string('receiver', 32)->index();
+            $table->json('event')->nullable();
+            $table->integer('fail')->default(0);
+            $table->integer('success')->default(0);
+            $table->string('status', 16)->index()->default('active');
+            $table->uuid("editor_uid")->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('web_hooks');
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_08_15_135700_add_status_in_discussions.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('discussions', function (Blueprint $table) {
+            //
+            $table->string('status', 16)->index()->default('active');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('discussions', function (Blueprint $table) {
+            //
+            $table->dropColumn('status');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_08_20_143627_add_sn_in_book_titles.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('book_titles', function (Blueprint $table) {
+            //
+            $table->integer('sn')->index()->default(0);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('book_titles', function (Blueprint $table) {
+            //
+            $table->dropColumn('sn');
+        });
+    }
+};

+ 34 - 0
api-v12/database/migrations/2023_09_17_113229_add_tpl_in_discussions.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('discussions', function (Blueprint $table) {
+            //
+            $table->uuid('tpl_id')->nullable()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('discussions', function (Blueprint $table) {
+            //
+            $table->dropColumn('tpl_id');
+        });
+    }
+};

+ 38 - 0
api-v12/database/migrations/2023_09_19_014131_add_titleen_in_pali_texts.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up(): void
+    {
+        Schema::table('pali_texts', function (Blueprint $table) {
+            //
+            $table->text('title_en')->nullable()->index();
+            $table->text('title')->nullable()->index();
+            $table->integer('pcd_book_id')->index()->default(0);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down(): void
+    {
+        Schema::table('pali_texts', function (Blueprint $table) {
+            //
+            $table->dropColumn('title_en');
+            $table->dropColumn('title');
+            $table->dropColumn('pcd_book_id');
+        });
+    }
+};

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio