|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Support\Facades\Schema; |
|
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
5
|
|
|
use Illuminate\Database\Migrations\Migration; |
|
6
|
|
|
|
|
7
|
|
|
class CreateProposedLessonsTable extends Migration |
|
|
|
|
|
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Run the migrations. |
|
11
|
|
|
* |
|
12
|
|
|
* @return void |
|
13
|
|
|
*/ |
|
14
|
|
|
public function up() |
|
15
|
|
|
{ |
|
16
|
|
|
Schema::create('proposed_lessons', function (Blueprint $table) { |
|
|
|
|
|
|
17
|
|
|
$table->increments('id'); |
|
18
|
|
|
$table->integer('location_id')->unsigned(); |
|
19
|
|
|
$table->string('state')->nullable(); |
|
20
|
|
|
$table->integer('desideratum_id')->unsigned(); |
|
21
|
|
|
//todo userstamps??? https://github.com/WildSideUK/Laravel-Userstamps?? https://github.com/acacha/Laravel-Userstamps |
|
|
|
|
|
|
22
|
|
|
$table->timestamps(); |
|
23
|
|
|
}); |
|
24
|
|
|
|
|
25
|
|
|
//Ha de tindre id, location_id, timestamps, userstamps, desideratum_id, |
|
26
|
|
|
//relacions amb User i amb Studysubmodule |
|
27
|
|
|
|
|
28
|
|
View Code Duplication |
Schema::create('proposed_lesson_user', function (Blueprint $table) { |
|
|
|
|
|
|
29
|
|
|
$table->integer('proposed_lesson_id')->unsigned(); |
|
30
|
|
|
$table->integer('user_id')->unsigned(); |
|
31
|
|
|
$table->timestamps(); |
|
32
|
|
|
$table->unique(['proposed_lesson_id', 'user_id']); |
|
33
|
|
|
}); |
|
34
|
|
|
|
|
35
|
|
View Code Duplication |
Schema::create('proposed_lesson_studysubmodule', function (Blueprint $table) { |
|
|
|
|
|
|
36
|
|
|
$table->integer('proposed_lesson_id')->unsigned(); |
|
37
|
|
|
$table->integer('studysubmodule_id')->unsigned(); |
|
38
|
|
|
$table->timestamps(); |
|
39
|
|
|
$table->unique(['proposed_lesson_id', 'studysubmodule_id']); |
|
40
|
|
|
}); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Reverse the migrations. |
|
45
|
|
|
* |
|
46
|
|
|
* @return void |
|
47
|
|
|
*/ |
|
48
|
|
|
public function down() |
|
49
|
|
|
{ |
|
50
|
|
|
Schema::dropIfExists('proposed_lesson_studysubmodule'); |
|
51
|
|
|
Schema::dropIfExists('proposed_lesson_user'); |
|
52
|
|
|
Schema::dropIfExists('proposed_lessons'); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
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.