2022_01_22_152901_create_sentences_table.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateSentencesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('sentences', function (Blueprint $table) {
  15. #使用雪花id
  16. $table->bigInteger('id')->primary();
  17. $table->string('uid',36)->uniqid()->index();
  18. $table->string('parent_uid',36)->nullable()->index();
  19. $table->string('block_uid',36)->nullable()->index();
  20. $table->string('channel_uid',36)->nullable()->index();
  21. $table->integer('book_id');
  22. $table->integer('paragraph');
  23. $table->integer('word_start');
  24. $table->integer('word_end');
  25. $table->string('author',512)->nullable();
  26. $table->string('editor_uid',36);
  27. $table->text('content')->nullable();
  28. $table->enum('content_type',['markdown','text','html'])->default('markdown');
  29. $table->string('language',16);
  30. $table->integer('version')->default(1);
  31. $table->integer('strlen');
  32. $table->integer('status')->default(10);
  33. $table->bigInteger('create_time')->index();
  34. $table->bigInteger('modify_time')->index();
  35. $table->timestamp('created_at')->useCurrent();
  36. $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
  37. $table->timestamp('deleted_at')->nullable();
  38. $table->index(['book_id','paragraph','word_start','word_end']);
  39. $table->index(['book_id','paragraph','word_start','word_end','channel_uid']);
  40. });
  41. }
  42. /**
  43. * Reverse the migrations.
  44. *
  45. * @return void
  46. */
  47. public function down()
  48. {
  49. Schema::dropIfExists('sentences');
  50. }
  51. }