From fe26fedbbc41491b69b9b5ebc11a372e774bf327 Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Wed, 28 Dec 2022 15:29:22 +0900 Subject: [PATCH] build: Cut out database.php embedded in .travis.yml --- .github/workflows/configs/database.php | 79 ++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/configs/database.php diff --git a/.github/workflows/configs/database.php b/.github/workflows/configs/database.php new file mode 100644 index 000000000..c98b7e817 --- /dev/null +++ b/.github/workflows/configs/database.php @@ -0,0 +1,79 @@ + array( + 'datasource' => 'Database/Mysql', + 'host' => '127.0.0.1', + 'login' => 'root' + ), + 'pgsql' => array( + 'datasource' => 'Database/Postgres', + 'host' => '127.0.0.1', + 'login' => 'postgres', + 'database' => 'cakephp_test', + 'schema' => array( + 'default' => 'public', + 'test' => 'public', + 'test2' => 'test2', + 'test_database_three' => 'test3' + ) + ), + 'sqlite' => array( + 'datasource' => 'Database/Sqlite', + 'database' => array( + 'default' => ':memory:', + 'test' => ':memory:', + 'test2' => '/tmp/cakephp_test2.db', + 'test_database_three' => '/tmp/cakephp_test3.db' + ), + ) + ); + public $default = array( + 'persistent' => false, + 'host' => '', + 'login' => '', + 'password' => '', + 'database' => 'cakephp_test', + 'prefix' => '' + ); + public $test = array( + 'persistent' => false, + 'host' => '', + 'login' => '', + 'password' => '', + 'database' => 'cakephp_test', + 'prefix' => '' + ); + public $test2 = array( + 'persistent' => false, + 'host' => '', + 'login' => '', + 'password' => '', + 'database' => 'cakephp_test2', + 'prefix' => '' + ); + public $test_database_three = array( + 'persistent' => false, + 'host' => '', + 'login' => '', + 'password' => '', + 'database' => 'cakephp_test3', + 'prefix' => '' + ); + public function __construct() { + $db = 'mysql'; + if (!empty($_SERVER['DB'])) { + $db = $_SERVER['DB']; + } + foreach (array('default', 'test', 'test2', 'test_database_three') as $source) { + $config = array_merge($this->{$source}, $this->identities[$db]); + if (is_array($config['database'])) { + $config['database'] = $config['database'][$source]; + } + if (!empty($config['schema']) && is_array($config['schema'])) { + $config['schema'] = $config['schema'][$source]; + } + $this->{$source} = $config; + } + } +}