Game-Jaming/Backend/Database/databaseMigration.php

26 lines
1.1 KiB
PHP
Raw Normal View History

2021-03-03 10:01:32 +00:00
<?php
2021-03-04 08:19:13 +00:00
//Path /Backend/Database/databaseMigration.php
2021-03-03 10:01:32 +00:00
2021-03-04 08:19:13 +00:00
/*
* 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
2021-03-05 10:23:10 +00:00
require "Password.php"; //Password has no foreign key
2021-03-04 08:19:13 +00:00
require "KeyWord.php"; //Group has foreign keys to the Group
2021-03-05 10:23:10 +00:00
require "Vote.php";
2021-03-12 10:10:14 +00:00
require "AdminUser.php";
\Backend\Models\AdminUser::firstOrCreate([
'user_name' => 'admin', 'password' => password_hash("Aa123456&",PASSWORD_DEFAULT)
]);