-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphinx-adapter.php
More file actions
47 lines (40 loc) · 1.23 KB
/
phinx-adapter.php
File metadata and controls
47 lines (40 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* AbraFlexi Webhook Acceptor - Phinx database adapter.
*
* @author Vítězslav Dvořák <info@vitexsoftware.cz>
* @copyright 2021-2023 Vitex Software
*/
if (file_exists('./vendor/autoload.php')) {
include_once './vendor/autoload.php';
} else {
include_once '../vendor/autoload.php';
}
\Ease\Shared::init(['DB_CONNECTION'],'../.env');
$prefix = file_exists('./db/') ? './db/' : '../db/';
$sqlOptions = [];
if (strstr(\Ease\Functions::cfg('DB_CONNECTION'), 'sqlite')) {
$sqlOptions['database'] = $prefix . basename(\Ease\Functions::cfg('DB_DATABASE'));
}
$engine = new \Ease\SQL\Engine(null, $sqlOptions);
$cfg = [
'paths' => [
'migrations' => [$prefix . 'migrations'],
'seeds' => [$prefix . 'seeds']
],
'environments' =>
[
'default_environment' => 'production',
'development' => [
'adapter' => \Ease\Functions::cfg('DB_CONNECTION'),
'name' => $engine->database,
'connection' => $engine->getPdo($sqlOptions)
],
'production' => [
'adapter' => \Ease\Functions::cfg('DB_CONNECTION'),
'name' => $engine->database,
'connection' => $engine->getPdo($sqlOptions)
],
]
];
return $cfg;