2022_12_29_125609_create_courses_table.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateCoursesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('courses', function (Blueprint $table) {
  15. $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
  16. $table->string('title',256)->index();
  17. $table->string('subtitle',256)->nullable();
  18. $table->string('cover',256)->nullable();
  19. $table->text('content')->nullable();
  20. $table->enum('content_type',['markdown','text','html'])->default('markdown');
  21. $table->uuid('teacher')->nullable()->index();
  22. $table->timestamp('start_at')->nullable()->index();
  23. $table->timestamp('end_at')->nullable()->index();
  24. $table->uuid('studio_id')->index();
  25. $table->timestamps();
  26. });
  27. }
  28. /**
  29. * Reverse the migrations.
  30. *
  31. * @return void
  32. */
  33. public function down()
  34. {
  35. Schema::dropIfExists('courses');
  36. }
  37. }