-
Notifications
You must be signed in to change notification settings - Fork 0
/
phinx.php
34 lines (29 loc) · 904 Bytes
/
phinx.php
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
<?php
use App\Helpers\Config;
try {
$pdo = new PDO(
"mysql:host=" . Config::get("DB_HOST") . ";port=" . (int)Config::get("DB_PORT") . ";dbname=" . Config::get("DB_DATABASE"),
Config::get("DB_USERNAME"),
Config::get("DB_PASSWORD"),
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]
);
} catch (Exception $e) {
echo "Erreur: " . $e->getMessage() . "<br/>";
echo "N°: " . $e->getCode();
}
$env = Config::get("APP_ENV");
return [
'paths' => [
'migrations' => __DIR__ . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'migrations',
'seeds' => __DIR__ . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'seeds'
],
'environments' => [
'default_database' => 'development',
'development' => [
'name' => 'stekosphp',
'connection' => $pdo
]
]
];