| @@ 10-38 (lines=29) @@ | ||
| 7 | /** |
|
| 8 | * Class CreateActivitiesTable |
|
| 9 | */ |
|
| 10 | class CreateActivitiesTable extends Migration |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * Run the migrations. |
|
| 14 | * |
|
| 15 | * @return void |
|
| 16 | */ |
|
| 17 | public function up() |
|
| 18 | { |
|
| 19 | Schema::create('activities', function (Blueprint $table) { |
|
| 20 | $table->increments('id'); |
|
| 21 | $table->unsignedInteger('user_id')->index(); |
|
| 22 | $table->unsignedInteger('subject_id')->index(); |
|
| 23 | $table->string('subject_type', 50); |
|
| 24 | $table->string('type', 50); |
|
| 25 | $table->timestamps(); |
|
| 26 | }); |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * Reverse the migrations. |
|
| 31 | * |
|
| 32 | * @return void |
|
| 33 | */ |
|
| 34 | public function down() |
|
| 35 | { |
|
| 36 | Schema::dropIfExists('activities'); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||
| @@ 7-42 (lines=36) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreateClassroomsTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | Schema::create('classrooms', function (Blueprint $table) { |
|
| 17 | $table->increments('id'); |
|
| 18 | $table->string('name'); |
|
| 19 | $table->timestamps(); |
|
| 20 | $table->integer('enrollment_id')->unsigned()->nullable(); |
|
| 21 | $table->integer('submodule_id')->unsigned()->nullable(); |
|
| 22 | }); |
|
| 23 | ||
| 24 | // Schema::create('classroom_enrollment', function (Blueprint $table) { |
|
| 25 | // $table->integer('classroom_id')->unsigned(); |
|
| 26 | // $table->integer('enrollment_id')->unsigned(); |
|
| 27 | // $table->timestamps(); |
|
| 28 | // $table->unique(['classroom_id', 'enrollment_id']); |
|
| 29 | // }); |
|
| 30 | } |
|
| 31 | /** |
|
| 32 | * Reverse the migrations. |
|
| 33 | * |
|
| 34 | * @return void |
|
| 35 | */ |
|
| 36 | public function down() |
|
| 37 | { |
|
| 38 | Schema::dropIfExists('classrooms'); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||