Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
webbingbrasil/exams-module / Database / Migrations / 2015_12_16_165051_create_exams_table.php
Size: Mime:
<?php

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

class CreateExamsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('exams', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->boolean('is_active')->default(true)->index();

            if (Module::has('Courses')) {
                if (!Schema::hasTable('courses')) {
                    Artisan::call('module:migrate', ['module' => 'Courses']);
                }
                $table->integer('course_id')->unsigned()->index()->nullable();
                $table->foreign('course_id')->references('id')->on('courses')->onDelete('cascade');
            }

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('exams');
    }

}