Game-Jaming/Backend/Database/Group.php

32 lines
1.1 KiB
PHP

<?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");
$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();
});
/*
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;
*/