2022_01_28_121154_create_articles_table.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateArticlesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('articles', function (Blueprint $table) {
  15. #使用雪花id
  16. $table->bigInteger('id')->primary();
  17. $table->string('uid',36)->uniqid()->index();
  18. $table->bigInteger('parent_id')->nullable()->index();
  19. $table->bigInteger('default_channel_id')->nullable()->index();
  20. $table->string('title',128)->index();
  21. $table->string('subtitle',128)->nullable();
  22. $table->string('summary',1024)->nullable();
  23. $table->text('cover')->nullable();
  24. $table->text('content')->nullable();
  25. $table->enum('content_type',['markdown','text','html'])->default('markdown');
  26. $table->string('owner',36)->index();
  27. $table->bigInteger('owner_id')->index();
  28. $table->bigInteger('editor_id')->index();
  29. $table->text('setting')->nullable();
  30. $table->integer('status')->default(10)->index();
  31. $table->string('lang',16)->default('none')->index();
  32. $table->bigInteger('create_time')->index();
  33. $table->bigInteger('modify_time')->index();
  34. $table->timestamp('created_at')->useCurrent();
  35. $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
  36. $table->timestamp('deleted_at')->nullable();
  37. });
  38. }
  39. /**
  40. * Reverse the migrations.
  41. *
  42. * @return void
  43. */
  44. public function down()
  45. {
  46. Schema::dropIfExists('articles');
  47. }
  48. }