2022_01_22_152901_create_sentences_table.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /*
  15. parent_uid VARCHAR (36),
  16. block_uid VARCHAR (36),
  17. channel_uid VARCHAR (36),
  18. book_id INTEGER NOT NULL,
  19. paragraph INTEGER NOT NULL,
  20. word_start INTEGER NOT NULL,
  21. word_end INTEGER NOT NULL,
  22. author TEXT,
  23. editor_uid VARCHAR (36),
  24. content TEXT,
  25. language VARCHAR (16),
  26. version INTEGER NOT NULL DEFAULT (1),
  27. status INTEGER NOT NULL DEFAULT (10),
  28. strlen INTEGER,
  29. */
  30. Schema::create('sentences', function (Blueprint $table) {
  31. #使用雪花id
  32. $table->bigInteger('id')->primary();
  33. $table->string('uid',36)->uniqid()->index();
  34. $table->string('parent_uid',36)->uniqid()->index();
  35. $table->string('block_uid',36)->uniqid()->index();
  36. $table->string('channel_uid',36)->uniqid()->index();
  37. $table->integer('book_id');
  38. $table->integer('paragraph');
  39. $table->integer('word_start');
  40. $table->integer('word_end');
  41. $table->string('author',512);
  42. $table->string('owner_uid',36);
  43. $table->bigInteger('editor_id');
  44. $table->string('name',128)->index();
  45. $table->string('summary',1024)->nullable();
  46. $table->string('lang',16);
  47. $table->integer('status')->default(10);
  48. $table->text('setting')->nullable();
  49. $table->bigInteger('create_time')->index();
  50. $table->bigInteger('modify_time')->index();
  51. $table->timestamp('created_at')->useCurrent();
  52. $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
  53. $table->timestamp('deleted_at')->nullable();
  54. });
  55. }
  56. /**
  57. * Reverse the migrations.
  58. *
  59. * @return void
  60. */
  61. public function down()
  62. {
  63. Schema::dropIfExists('sentences');
  64. }
  65. }