123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
-
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
-
- class CreateActivitiesTable extends Migration {
-
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('activities', function(Blueprint $table)
- {
- $table->increments('id');
- $table->string('name');
- $table->string('description');
- $table->integer('course_id')->unsigned();
- $table->integer('rubric_id')->unsigned()->nullable();
- $table->timestamps();
- });
-
- Schema::table('activities', function(Blueprint $table)
- {
- $table->foreign('course_id')->references('id')->on('courses')->onDelete('cascade')->onUpdate('cascade');
- $table->foreign('rubric_id')->references('id')->on('rubrics')->onDelete('cascade')->onUpdate('cascade');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('activities');
- }
-
- }
|