Game-Jaming/Backend/Database/databaseMigration.php

26 lines
1.1 KiB
PHP

<?php
//Path /Backend/Database/databaseMigration.php
/*
* databaseMigration is used to auto crate the various tables in the database.
* To call/run the databaseMigration visited the "Path".
* There is a reason to why we call GameJam first, the reason being
* that GameJam doesn't have any foreign key in the table, we can't
* create a table that depends on a foreign key, so we create all the tables
* without a foreign key in it, after that we are able to create the tables
* with foreign keys in it.
*
* See the Database Diagram for detailed understand.
*/
require "GameJam.php"; //GameJam has no foreign key
require "GameData.php"; //GameData 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";
require "AdminUser.php";
\Backend\Models\AdminUser::firstOrCreate([
'user_name' => 'admin', 'password' => password_hash("Aa123456&",PASSWORD_DEFAULT)
]);