From 17cb0373afba06494d0160f1337f0c8d1061debe Mon Sep 17 00:00:00 2001
From: Kurniandha Sukma Yunastrian <13516106@std.stei.itb.ac.id>
Date: Tue, 18 May 2021 14:03:37 +0700
Subject: [PATCH] Add migration for criteria

---
 ...05_05_075954_create_userprojects_table.php |  1 +
 ...05_05_131925_create_requirements_table.php |  2 +-
 ...21_05_18_062942_create_criterias_table.php | 35 +++++++++++++++++++
 ...5_18_063209_create_criteriavotes_table.php | 32 +++++++++++++++++
 ...18_063224_create_criteriaweights_table.php | 34 ++++++++++++++++++
 ...63234_create_criteriaweightvotes_table.php | 32 +++++++++++++++++
 6 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 database/migrations/2021_05_18_062942_create_criterias_table.php
 create mode 100644 database/migrations/2021_05_18_063209_create_criteriavotes_table.php
 create mode 100644 database/migrations/2021_05_18_063224_create_criteriaweights_table.php
 create mode 100644 database/migrations/2021_05_18_063234_create_criteriaweightvotes_table.php

diff --git a/database/migrations/2021_05_05_075954_create_userprojects_table.php b/database/migrations/2021_05_05_075954_create_userprojects_table.php
index f21bffe..d0f0be7 100644
--- a/database/migrations/2021_05_05_075954_create_userprojects_table.php
+++ b/database/migrations/2021_05_05_075954_create_userprojects_table.php
@@ -17,6 +17,7 @@ class CreateUserprojectsTable extends Migration
             $table->integer('idUser');
             $table->integer('idProject');
             $table->integer('role');
+            $table->integer('phase');
             $table->timestamps();
         });
     }
diff --git a/database/migrations/2021_05_05_131925_create_requirements_table.php b/database/migrations/2021_05_05_131925_create_requirements_table.php
index ebabae3..4ed2f78 100644
--- a/database/migrations/2021_05_05_131925_create_requirements_table.php
+++ b/database/migrations/2021_05_05_131925_create_requirements_table.php
@@ -18,7 +18,7 @@ class CreateRequirementsTable extends Migration
             $table->integer('idProject');
             $table->integer('number');
             $table->string('name');
-            $table->double('score', 8, 2)->nullable();;
+            $table->double('score', 8, 2)->nullable();
             $table->timestamps();
         });
     }
diff --git a/database/migrations/2021_05_18_062942_create_criterias_table.php b/database/migrations/2021_05_18_062942_create_criterias_table.php
new file mode 100644
index 0000000..73462d6
--- /dev/null
+++ b/database/migrations/2021_05_18_062942_create_criterias_table.php
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCriteriasTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('criterias', function (Blueprint $table) {
+            $table->id();
+            $table->integer('idProject');
+            $table->string('name');
+            $table->integer('weight')->nullable();
+            $table->integer('used');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('criterias');
+    }
+}
diff --git a/database/migrations/2021_05_18_063209_create_criteriavotes_table.php b/database/migrations/2021_05_18_063209_create_criteriavotes_table.php
new file mode 100644
index 0000000..10979f3
--- /dev/null
+++ b/database/migrations/2021_05_18_063209_create_criteriavotes_table.php
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCriteriavotesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('criteriavotes', function (Blueprint $table) {
+            $table->integer('idUser');
+            $table->integer('idCriteria');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('criteriavotes');
+    }
+}
diff --git a/database/migrations/2021_05_18_063224_create_criteriaweights_table.php b/database/migrations/2021_05_18_063224_create_criteriaweights_table.php
new file mode 100644
index 0000000..4a0cb7c
--- /dev/null
+++ b/database/migrations/2021_05_18_063224_create_criteriaweights_table.php
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCriteriaweightsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('criteriaweights', function (Blueprint $table) {
+            $table->id();
+            $table->integer('idUser');
+            $table->integer('idCriteria');
+            $table->integer('weight');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('criteriaweights');
+    }
+}
diff --git a/database/migrations/2021_05_18_063234_create_criteriaweightvotes_table.php b/database/migrations/2021_05_18_063234_create_criteriaweightvotes_table.php
new file mode 100644
index 0000000..b699c8b
--- /dev/null
+++ b/database/migrations/2021_05_18_063234_create_criteriaweightvotes_table.php
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCriteriaweightvotesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('criteriaweightvotes', function (Blueprint $table) {
+            $table->integer('idUser');
+            $table->integer('idWeight');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('criteriaweightvotes');
+    }
+}
-- 
GitLab