EscolaLMS/Courses

View on GitHub
database/migrations/2021_04_27_1619520602_create_courses_table.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCoursesTable extends Migration
{
    public function up()
    {
        Schema::create('courses', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();
            $table->string('title');
            $table->text('summary')->nullable();
            $table->string('image_path')->nullable();
            $table->string('video_path')->nullable();
            $table->integer('base_price')->nullable();
            $table->string('duration')->nullable();
            $table->bigInteger('author_id')->unsigned()->nullable();
            $table->foreign('author_id')->references('id')->on('users');
        });
    }

    public function down()
    {
        Schema::dropIfExists('courses');
    }
}