diff --git a/README.md b/README.md index 29fc5bd..b3e5973 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/index.php b/src/index.php index 2bcd94b..56cc481 100644 --- a/src/index.php +++ b/src/index.php @@ -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); diff --git a/src/setup/setup.php b/src/setup/setup.php index e69de29..b6509d7 100644 --- a/src/setup/setup.php +++ b/src/setup/setup.php @@ -0,0 +1,22 @@ +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); + } + +?> \ No newline at end of file diff --git a/start.sh b/start.sh index 2a67cfd..ae5d610 100644 --- a/start.sh +++ b/start.sh @@ -1,2 +1,4 @@ #!/bin/bash docker-compose up -d +docker exec -ti php_web php setup/setup.php +bash test.sh