-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathphinx.php
55 lines (45 loc) · 1.54 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
require __DIR__ . '/vendor/autoload.php';
defined('ROOT') ?: define('ROOT', __DIR__);
if (file_exists(__DIR__ . '/cache/settings.php')) {
// Use cache settings
$settings = require __DIR__ . '/cache/settings.php';
} else {
// Load .env file
$settings = require __DIR__ . '/app/settings.php';
}
$database = $settings['database'];
$capsule = new Illuminate\Database\Capsule\Manager;
$capsule->addConnection([
'driver' => $database['driver'],
'host' => $database['host'],
'database' => $database['database'],
'username' => $database['username'],
'password' => $database['password'],
'charset' => $database['charset'],
'collation' => $database['collation'],
'prefix' => $database['prefix'],
]);
$capsule->setAsGlobal();
$capsule->getConnection()->getSchemaBuilder()->defaultStringLength(190);
return [
'paths' => [
'migrations' => __DIR__ . '/database/migrations',
'seeds' => __DIR__ . '/database/seeds',
],
'migration_base_class' => App\Support\Database\Migrations\Migration::class,
'templates' => [
'file' => __DIR__ . '/app/Database/Migrations/Migration.stub'
],
'environments' => [
'default_migration_table' => 'migrations',
'default' => [
'adapter' => $database['driver'],
'host' => $database['host'],
'port' => $database['port'],
'name' => $database['database'],
'user' => $database['username'],
'pass' => $database['password'],
],
]
];