Travis DB setup

- Added testing setup command for configuring testing db and environment
- Updated travis.yml to use MySQL service

Apply fixes from StyleCI

added user to access db in travis.yml

updates

updates

Apply fixes from StyleCI
This commit is contained in:
Manish Verma
2018-09-17 12:15:29 +05:30
committed by Manish Verma
parent 6742e13d81
commit 426a285431
4 changed files with 224 additions and 0 deletions

View File

@@ -270,3 +270,23 @@ function exceptionResponse(\Exception $exception)
'exception' => $exception->getMessage(),
], 500);
}
/**
* Creates an empty DB with given name.
*
* @param string $dbName name of the DB
*
* @return null
*/
function createDB(string $dbName)
{
\DB::purge('mysql');
// removing old db
\DB::connection('mysql')->getPdo()->exec("DROP DATABASE IF EXISTS `{$dbName}`");
// Creating testing_db
\DB::connection('mysql')->getPdo()->exec("CREATE DATABASE `{$dbName}`");
//disconnecting it will remove database config from the memory so that new database name can be
// populated
\DB::disconnect('mysql');
}