12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
-
- 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->increments('id');
- $table->string('name');
- $table->char('code', 8);
- $table->char('section', 3);
- $table->integer('program_id')->unsigned();
- $table->integer('user_id')->unsigned();
- $table->timestamps();
- });
-
- Schema::table('courses', function(Blueprint $table)
- {
- $table->foreign('program_id')->references('id')->on('programs')->onDelete('cascade')->onUpdate('cascade');
- $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('courses');
- }
-
- }
|