123456789101112131415161718192021222324252627282930313233343536 |
- <?php
-
- use Illuminate\Support\Facades\Schema;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
-
- class CreateCoursesTable extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('courses', function (Blueprint $table) {
- $table->bigIncrements('id');
- $table->char('code', 8)->unique();
- $table->string('title');
- $table->unsignedBigInteger('dept_id')->default(7);
- $table->string('syllabus')->nullable();
-
- $table->foreign('dept_id')->references('id')->on('departments')->onUpdate('cascade');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('courses');
- }
- }
|