mirror of
				https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
				synced 2025-10-31 09:09:00 +00:00 
			
		
		
		
	Added table create routine
This commit is contained in:
		| @@ -33,6 +33,9 @@ To run the program execute: | ||||
| ```bash | ||||
|   bash ./start.sh | ||||
| ``` | ||||
| ### Attention | ||||
| This is a demo program; Everytime when you start the demo the database will be reset. | ||||
|  | ||||
| ## test | ||||
| To run the tests execute: | ||||
| ```bash | ||||
|   | ||||
| @@ -3,7 +3,6 @@ use router\Router; | ||||
| use core\Core; | ||||
|  | ||||
| require __DIR__. '/vendor/autoload.php'; | ||||
| #phpinfo(); | ||||
| $core = new Core(); | ||||
| $router = new Router(); | ||||
| $router->setCore($core); | ||||
|   | ||||
| @@ -0,0 +1,22 @@ | ||||
| <?php  | ||||
|     use core\Core; | ||||
|      | ||||
|     require __DIR__. '/../vendor/autoload.php'; | ||||
|      | ||||
|     /** | ||||
|      * Maintainance script - Not written nice ;) | ||||
|      **/ | ||||
|      | ||||
|     function loadAndExec(string $file){ | ||||
|         $core = new Core(); | ||||
|         $pdo = $core->getDatabase(); | ||||
|         echo "Create database $file...\n"; | ||||
|         $pdo->exec(file_get_contents(__DIR__.'/database/'.$file.'.sql')); | ||||
|     } | ||||
|      | ||||
|     echo "Create databases...\n"; | ||||
|     foreach(['order_product','order','product','user'] as $file){ | ||||
|         loadAndExec($file); | ||||
|     } | ||||
|      | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user