new db migration
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
@@ -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";
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
Reference in New Issue
Block a user