| @@ 11-42 (lines=32) @@ | ||
| 8 | /** |
|
| 9 | * Class CreateCoursesTable |
|
| 10 | */ |
|
| 11 | class CreateCoursesTable extends Migration |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * Run the migrations. |
|
| 15 | * |
|
| 16 | * @return void |
|
| 17 | */ |
|
| 18 | public function up() |
|
| 19 | { |
|
| 20 | Schema::create('courses', function (Blueprint $table) { |
|
| 21 | $table->increments('id'); |
|
| 22 | $table->string('name'); |
|
| 23 | $table->timestamps(); |
|
| 24 | }); |
|
| 25 | Schema::create('course_study', function (Blueprint $table) { |
|
| 26 | $table->integer('course_id')->unsigned(); |
|
| 27 | $table->integer('study_id')->unsigned(); |
|
| 28 | $table->timestamps(); |
|
| 29 | $table->unique(['course_id', 'study_id']); |
|
| 30 | }); |
|
| 31 | } |
|
| 32 | /** |
|
| 33 | * Reverse the migrations. |
|
| 34 | * |
|
| 35 | * @return void |
|
| 36 | */ |
|
| 37 | public function down() |
|
| 38 | { |
|
| 39 | Schema::dropIfExists('courses'); |
|
| 40 | Schema::dropIfExists('course_study'); |
|
| 41 | } |
|
| 42 | } |
|
| @@ 7-38 (lines=32) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreateFamiliesTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | Schema::create('families', function (Blueprint $table) { |
|
| 17 | $table->increments('id'); |
|
| 18 | $table->timestamps(); |
|
| 19 | }); |
|
| 20 | Schema::create('family_study', function (Blueprint $table) { |
|
| 21 | $table->integer('family_id')->unsigned(); |
|
| 22 | $table->integer('study_id')->unsigned(); |
|
| 23 | $table->timestamps(); |
|
| 24 | $table->unique(['family_id', 'study_id']); |
|
| 25 | }); |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Reverse the migrations. |
|
| 30 | * |
|
| 31 | * @return void |
|
| 32 | */ |
|
| 33 | public function down() |
|
| 34 | { |
|
| 35 | Schema::dropIfExists('families'); |
|
| 36 | Schema::dropIfExists('family_study'); |
|
| 37 | } |
|
| 38 | } |
|