Files
This commit is contained in:
24
setup/databases.php
Normal file
24
setup/databases.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
$database = $app->getContainer()->get('database');
|
||||
|
||||
foreach ($database->databases as $name => $settings) {
|
||||
switch (strtolower($settings->engine)) {
|
||||
case 'mysql':
|
||||
$dsn = "mysql:host={$settings->host->name};dbname={$settings->name}" . (isset($settings->host->port) ? ';port=' . $settings->host->port : '');
|
||||
ORM::configure([
|
||||
'connection_string' => $dsn,
|
||||
'username' => $settings->user->name,
|
||||
'password' => $settings->user->password
|
||||
], null, $name);
|
||||
break;
|
||||
}
|
||||
if (isset($settings->logging) and $settings->logging) {
|
||||
ORM::configure('logging', true, $name);
|
||||
}
|
||||
if (isset($settings->caching) and $settings->caching) {
|
||||
ORM::configure('caching', true, $name);
|
||||
}
|
||||
}
|
||||
if (isset($database->short_names) and $database->short_names) {
|
||||
Model::$short_table_names = true;
|
||||
}
|
Reference in New Issue
Block a user