Made documentation on migrations

This commit is contained in:
neerholt
2021-03-04 09:19:13 +01:00
parent 2e6671bf7b
commit 119732114f
8 changed files with 108 additions and 11 deletions
+17 -1
View File
@@ -1,9 +1,11 @@
<?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 groups table with the rows as id, groupName, groupAmount, fkGameJam, votes, fkPassword, fkGameData and timestamp
Capsule::schema()->create("groups", function (Blueprint $table){
$table->id();
$table->string("groupName");
@@ -13,4 +15,18 @@ Capsule::schema()->create("groups", function (Blueprint $table){
$table->foreignId("fkPassword")->constrained("password");
$table->foreignId("fkGameData")->nullable()->constrained("game_data");
$table->timestamps();
});
});
/*
Syntex to create table in database
$table->string("texts");
$table => valuable;
string => datatype;
("texts") => name for the row in the database;
nullable => is allowed to not have a value in the database;
foreignId => foreignId key row name in the database;
constrained => targeted table name;
*/