new db migration

This commit is contained in:
2021-03-05 11:23:10 +01:00
parent 01f6e16283
commit d2182f5020
10 changed files with 29 additions and 50 deletions
+1
View File
@@ -10,6 +10,7 @@ Capsule::schema()->create("game_data", function (Blueprint $table){
$table->id();
$table->string("gameLink");
$table->boolean("isWebBased");
$table->string("img");
$table->timestamps();
});
-2
View File
@@ -11,8 +11,6 @@ Capsule::schema()->create("groups", function (Blueprint $table){
$table->string("groupName");
$table->integer("groupAmount");
$table->foreignId("game_jam_id")->constrained("game_jams");
$table->integer("votes")->nullable();
$table->foreignId("password_id")->constrained("passwords");
$table->foreignId("game_data_id")->nullable()->constrained("game_data");
$table->timestamps();
});
+1
View File
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Schema;
//Create password table with the rows as id, password, rememberToken and timestamps
Capsule::schema()->create("passwords", function (Blueprint $table){
$table->id();
$table->foreignId("group_id")->constrained("groups");
$table->string('password');
$table->rememberToken();
$table->timestamps();
+14
View File
@@ -0,0 +1,14 @@
<?php
require_once "../../bootstrap.php";
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Capsule::schema()->create("votes", function (Blueprint $table){
$table->id();
$table->foreignId("group_id")->constrained("groups");
$table->tinyInteger("points");
$table->text("comment")->nullable();
$table->timestamps();
});
+2 -1
View File
@@ -15,6 +15,7 @@
require "GameJam.php"; //GameJam has no foreign key
require "GameData.php"; //GameData has no foreign key
require "Password.php"; //Password has no foreign key
require "Group.php"; //Group has foreign keys to the GameJam, GameData and Password tables hence we create it as one of the last tables in the database
require "Password.php"; //Password has no foreign key
require "KeyWord.php"; //Group has foreign keys to the Group
require "Vote.php";
-23
View File
@@ -1,23 +0,0 @@
<?php
//require bootstrap aka our database connection
require_once "../../bootstrap.php";
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
//Create has_voted table with the rows as id and timestamp
Capsule::schema()->create("has_voted", function (Blueprint $table){
$table->id();
$table->timestamps();
});
/*
Syntex to create table in database
$table->string("texts");
$table => valuable;
string => datatype;
("texts") => name for the row in the database
*/