2022_12_19_125601_create_discussions_table.php 1015 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateDiscussionsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('discussions', function (Blueprint $table) {
  15. $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
  16. $table->uuid('res_id')->index();
  17. $table->string('res_type',32)->index();
  18. $table->uuid('parent')->index()->nullable();
  19. $table->string('title',256)->nullable();
  20. $table->text('content')->nullable();
  21. $table->integer('children_count')->default(0);
  22. $table->uuid('editor_uid')->index();
  23. $table->string('publicity',32)->default('public');
  24. $table->timestamps();
  25. });
  26. }
  27. /**
  28. * Reverse the migrations.
  29. *
  30. * @return void
  31. */
  32. public function down()
  33. {
  34. Schema::dropIfExists('discussions');
  35. }
  36. }