|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Support\Facades\Schema; |
|
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
5
|
|
|
use Illuminate\Database\Migrations\Migration; |
|
6
|
|
|
|
|
7
|
|
|
class CreateEnrollmentsTable extends Migration |
|
|
|
|
|
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Run the migrations. |
|
11
|
|
|
* |
|
12
|
|
|
* @return void |
|
13
|
|
|
*/ |
|
14
|
|
|
public function up() |
|
15
|
|
|
{ |
|
16
|
|
|
Schema::create('enrollments', function (Blueprint $table) { |
|
|
|
|
|
|
17
|
|
|
$table->increments('id'); //obligatori |
|
18
|
|
|
$table->string('name'); //CAMP NO FORMA PART, només vull provar. |
|
19
|
|
|
$table->boolean('validated')->nullable(); //només les vàlides són actives. |
|
20
|
|
|
$table->boolean('finished')->nullable(); //indica si la matricula està finalitzada. |
|
21
|
|
|
//$table->integer('period_id'); //De moment descartat //obligatori |
|
|
|
|
|
|
22
|
|
|
$table->integer('user_id')->unsigned()->nullable(); //indica si la matricula està finalitzada. |
|
23
|
|
|
$table->integer('classroom_id')->unsigned()->nullable(); //indica si la matricula està finalitzada. |
|
24
|
|
|
$table->integer('study_id')->unsigned()->nullable(); |
|
25
|
|
|
$table->integer('course_id')->unsigned()->nullable(); |
|
26
|
|
|
$table->timestamps(); //timestamps |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
// $table->foreign('classroom_id')->references('id')->on('classrooms'); //indica si la matricula està finalitzada. |
|
|
|
|
|
|
31
|
|
|
// $table->foreign('study_id')->references('id')->on('studies'); |
|
32
|
|
|
// $table->foreign('course_id')->references('id')->on('courses'); |
|
33
|
|
|
}); |
|
34
|
|
|
|
|
35
|
|
|
// Schema::create('enrollment_user', function (Blueprint $table) { |
|
|
|
|
|
|
36
|
|
|
// $table->integer('enrollment_id')->unsigned(); |
|
37
|
|
|
// $table->integer('user_id')->unsigned(); |
|
38
|
|
|
// $table->timestamps(); |
|
39
|
|
|
// $table->unique(['enrollment_id', 'user_id']); |
|
40
|
|
|
// }); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Reverse the migrations. |
|
45
|
|
|
* |
|
46
|
|
|
* @return void |
|
47
|
|
|
*/ |
|
48
|
|
|
public function down() |
|
49
|
|
|
{ |
|
50
|
|
|
Schema::dropIfExists('enrollments'); |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.