Pārlūkot izejas kodu

Database changes

José Quiñones Flores 4 gadus atpakaļ
vecāks
revīzija
3d1f1c2bfc

+ 1
- 0
app/config/database.php Parādīt failu

@@ -55,6 +55,7 @@ return array(
55 55
 			'charset'   => 'utf8',
56 56
 			'collation' => 'utf8_unicode_ci',
57 57
 			'prefix'    => '',
58
+            'engine'    => 'InnoDB',
58 59
 		),
59 60
 	),
60 61
 

+ 1
- 1
app/database/migrations/2018_08_09_110813_remove_password_updated_and_remember_token_from_users_table.php Parādīt failu

@@ -29,7 +29,7 @@ class RemovePasswordUpdatedAndRememberTokenFromUsersTable extends Migration {
29 29
 		Schema::table('users', function(Blueprint $table)
30 30
 		{
31 31
 			$table->rememberToken();
32
-			$table->boolean('password_updated')->after('program_id')->default(false);
32
+			$table->boolean('password_updated')->default(false);
33 33
 		});
34 34
 	}
35 35
 

+ 50
- 0
app/database/migrations/2020_04_04_002657_create_new_criteria_table.php Parādīt failu

@@ -0,0 +1,50 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+
6
+class CreateNewCriteriaTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('new_criteria', function(Blueprint $table)
16
+		{
17
+            $table->increments('id');
18
+            $table->string('name');
19
+            $table->string('subcriteria')->nullable();
20
+            $table->text('description12');
21
+            $table->text('description34');
22
+            $table->text('description56');
23
+            $table->text('description78');
24
+            $table->integer('objective_id')->unsigned();
25
+            $table->integer('program_id')->unsigned()->nullable();
26
+            $table->integer('user_id')->unsigned()->nullable();
27
+            $table->text('copyright')->nullable();
28
+            $table->text('notes')->nullable();
29
+
30
+            $table->timestamps();
31
+            $table->timestamp('deleted_at')->nullable();
32
+
33
+            $table->foreign('objective_id')->references('id')->on('objectives')->onDelete('cascade')->onUpdate('cascade');
34
+            $table->foreign('program_id')->references('id')->on('programs')->onDelete('cascade')->onUpdate('cascade');
35
+            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
36
+		});
37
+	}
38
+
39
+
40
+	/**
41
+	 * Reverse the migrations.
42
+	 *
43
+	 * @return void
44
+	 */
45
+	public function down()
46
+	{
47
+		Schema::drop('new_criteria');
48
+	}
49
+
50
+}

+ 39
- 0
app/database/migrations/2020_04_04_005817_add_outcome_id_to_objectives_table.php Parādīt failu

@@ -0,0 +1,39 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+
6
+class AddOutcomeIdToObjectivesTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::table('objectives', function(Blueprint $table)
16
+		{
17
+			$table->integer('outcome_id')->unsigned();
18
+
19
+			$table->foreign('outcome_id')->references('id')->on('outcomes')->onDelete('cascade')->onUpdate('cascade');
20
+		});
21
+	}
22
+
23
+
24
+	/**
25
+	 * Reverse the migrations.
26
+	 *
27
+	 * @return void
28
+	 */
29
+	public function down()
30
+	{
31
+		Schema::table('objectives', function(Blueprint $table)
32
+		{
33
+		    $table->dropForeign('objectives_outcome_id_foreign');
34
+
35
+			$table->dropColumn('outcome_id');
36
+		});
37
+	}
38
+
39
+}

+ 50
- 0
app/database/migrations/2020_04_22_090200_alter_activities_table.php Parādīt failu

@@ -0,0 +1,50 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+
6
+class AlterActivitiesTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::table('activities', function(Blueprint $table)
16
+		{
17
+		    $table->dropForeign('activities_rubric_id_foreign');
18
+			$table->dropColumn('rubric_id');
19
+
20
+			DB::statement('SET FOREIGN_KEY_CHECKS=0;');
21
+			DB::statement('ALTER TABLE `activities` MODIFY `course_id` INTEGER UNSIGNED NULL;');
22
+            DB::statement('SET FOREIGN_KEY_CHECKS=1;');
23
+        });
24
+	}
25
+
26
+
27
+	/**
28
+	 * Reverse the migrations.
29
+	 *
30
+	 * @return void
31
+	 */
32
+	public function down()
33
+	{
34
+		Schema::table('activities', function(Blueprint $table)
35
+		{
36
+            DB::statement('SET FOREIGN_KEY_CHECKS=0;');
37
+            DB::statement('ALTER TABLE `activities` MODIFY `course_id` INTEGER UNSIGNED NOT NULL;');
38
+            DB::statement('SET FOREIGN_KEY_CHECKS=1;');
39
+
40
+            $table->integer('rubric_id')->unsigned()->nullable();
41
+            $table
42
+                ->foreign('rubric_id')
43
+                ->references('id')
44
+                ->on('rubrics')
45
+                ->onDelete('cascade')
46
+                ->onUpdate('cascade');
47
+        });
48
+	}
49
+
50
+}

+ 48
- 0
app/database/migrations/2020_04_22_095649_create_new_criterion_rubric_table.php Parādīt failu

@@ -0,0 +1,48 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+
6
+class CreateNewCriterionRubricTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('new_criterion_rubric', function(Blueprint $table)
16
+		{
17
+			$table->increments('id');
18
+			$table->integer('criterion_id')->unsigned();
19
+			$table->integer('rubric_id')->unsigned();
20
+			$table->timestamps();
21
+
22
+			$table
23
+                ->foreign('criterion_id')
24
+                ->references('id')
25
+                ->on('new_criteria')
26
+                ->onDelete('cascade')
27
+                ->onUpdate('cascade');
28
+			$table
29
+                ->foreign('rubric_id')
30
+                ->references('id')
31
+                ->on('rubrics')
32
+                ->onDelete('cascade')
33
+                ->onUpdate('cascade');
34
+		});
35
+	}
36
+
37
+
38
+	/**
39
+	 * Reverse the migrations.
40
+	 *
41
+	 * @return void
42
+	 */
43
+	public function down()
44
+	{
45
+		Schema::drop('new_criterion_rubric');
46
+	}
47
+
48
+}

+ 48
- 0
app/database/migrations/2020_04_22_101110_create_new_rubric_activity_table.php Parādīt failu

@@ -0,0 +1,48 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+
6
+class CreateNewRubricActivityTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('new_rubric_activity', function(Blueprint $table)
16
+		{
17
+			$table->increments('id');
18
+			$table->integer('rubric_id')->unsigned();
19
+			$table->integer('activity_id')->unsigned();
20
+			$table->timestamps();
21
+
22
+			$table
23
+                ->foreign('rubric_id')
24
+                ->references('id')
25
+                ->on('rubrics')
26
+                ->onDelete('cascade')
27
+                ->onUpdate('cascade');
28
+			$table
29
+                ->foreign('activity_id')
30
+                ->references('id')
31
+                ->on('activities')
32
+                ->onDelete('cascade')
33
+                ->onUpdate('cascade');
34
+		});
35
+	}
36
+
37
+
38
+	/**
39
+	 * Reverse the migrations.
40
+	 *
41
+	 * @return void
42
+	 */
43
+	public function down()
44
+	{
45
+		Schema::drop('new_rubric_activity');
46
+	}
47
+
48
+}

+ 43
- 0
app/database/migrations/2020_04_22_122910_add_criteria_id_to_assessments_table.php Parādīt failu

@@ -0,0 +1,43 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+
6
+class AddCriteriaIdToAssessmentsTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::table('assessments', function(Blueprint $table)
16
+		{
17
+			$table->integer('criterion_id')->unsigned();
18
+
19
+			$table
20
+                ->foreign('criterion_id')
21
+                ->references('id')
22
+                ->on('criteria')
23
+                ->onDelete('cascade')
24
+                ->onUpdate('cascade');
25
+		});
26
+	}
27
+
28
+
29
+	/**
30
+	 * Reverse the migrations.
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public function down()
35
+	{
36
+		Schema::table('assessments', function(Blueprint $table)
37
+		{
38
+		    $table->dropForeign('assessments_criterion_id_foreign');
39
+		    $table->dropColumn('criterion_id');
40
+		});
41
+	}
42
+
43
+}