Переход на dblib
This commit is contained in:
@@ -28,7 +28,6 @@ DB_USERNAME=root
|
|||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
|
|
||||||
MIS_DB_HOST=
|
MIS_DB_HOST=
|
||||||
MIS_DB_PORT=1433
|
|
||||||
MIS_DB_DATABASE=
|
MIS_DB_DATABASE=
|
||||||
MIS_DB_USERNAME=
|
MIS_DB_USERNAME=
|
||||||
MIS_DB_PASSWORD=
|
MIS_DB_PASSWORD=
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Database\Grammars\CustomOdbcGrammar;
|
||||||
use App\Domain\Patient\Contracts\PatientRepositoryInterface;
|
use App\Domain\Patient\Contracts\PatientRepositoryInterface;
|
||||||
use App\Infrastructure\Database\Repositories\Patient\PatientRepository;
|
use App\Infrastructure\Database\Repositories\Patient\PatientRepository;
|
||||||
use App\Models\DepartmentPatient;
|
use App\Models\DepartmentPatient;
|
||||||
@@ -12,6 +13,7 @@ use App\Observers\ReportDutyObserver;
|
|||||||
use App\Observers\ReportNurseObserver;
|
use App\Observers\ReportNurseObserver;
|
||||||
use App\Services\Cache\CacheInvalidator;
|
use App\Services\Cache\CacheInvalidator;
|
||||||
use App\Services\Cache\CacheKeyBuilder;
|
use App\Services\Cache\CacheKeyBuilder;
|
||||||
|
use Illuminate\Database\Connection;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
@@ -41,5 +43,13 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
ReportNurse::observe(ReportNurseObserver::class);
|
ReportNurse::observe(ReportNurseObserver::class);
|
||||||
ReportDuty::observe(ReportDutyObserver::class);
|
ReportDuty::observe(ReportDutyObserver::class);
|
||||||
DepartmentPatient::observe(DepartmentPatientObserver::class);
|
DepartmentPatient::observe(DepartmentPatientObserver::class);
|
||||||
|
|
||||||
|
// Подключение DBLIB для MSSQL
|
||||||
|
Connection::resolverFor('dblib', function ($connection, $database, $prefix, $config) {
|
||||||
|
// Создаём PDO через DBLIB
|
||||||
|
$dsn = "dblib:host={$config['host']};dbname={$config['database']}";
|
||||||
|
$pdo = new \PDO($dsn, $config['username'], $config['password'], $config['options'] ?? []);
|
||||||
|
return new Connection($pdo, $database, $prefix, $config);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,22 +114,32 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
// МИС
|
// МИС
|
||||||
|
// 'mis' => [
|
||||||
|
// 'driver' => 'sqlsrv',
|
||||||
|
// 'url' => env('MIS_DB_URL'),
|
||||||
|
// 'host' => env('MIS_DB_HOST', 'localhost'),
|
||||||
|
// 'port' => env('MIS_DB_PORT', '1433'),
|
||||||
|
// 'database' => env('MIS_DB_DATABASE', 'laravel'),
|
||||||
|
// 'username' => env('MIS_DB_USERNAME', 'root'),
|
||||||
|
// 'password' => env('MIS_DB_PASSWORD', ''),
|
||||||
|
// 'charset' => env('MIS_DB_CHARSET', 'utf8'),
|
||||||
|
// 'prefix' => '',
|
||||||
|
// 'prefix_indexes' => true,
|
||||||
|
// 'encrypt' => env('DB_ENCRYPT', 'no'),
|
||||||
|
// //'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'true'),
|
||||||
|
// 'options' => [
|
||||||
|
// 'TrustServerCertificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'true'),
|
||||||
|
// ]
|
||||||
|
// ],
|
||||||
'mis' => [
|
'mis' => [
|
||||||
'driver' => 'sqlsrv',
|
'driver' => 'dblib',
|
||||||
'url' => env('MIS_DB_URL'),
|
'host' => env('MIS_DB_HOST'),
|
||||||
'host' => env('MIS_DB_HOST', 'localhost'),
|
'database' => env('MIS_DB_DATABASE'),
|
||||||
'port' => env('MIS_DB_PORT', '1433'),
|
'username' => env('MIS_DB_USERNAME'),
|
||||||
'database' => env('MIS_DB_DATABASE', 'laravel'),
|
'password' => env('MIS_DB_PASSWORD'),
|
||||||
'username' => env('MIS_DB_USERNAME', 'root'),
|
'charset' => 'utf8',
|
||||||
'password' => env('MIS_DB_PASSWORD', ''),
|
|
||||||
'charset' => env('MIS_DB_CHARSET', 'utf8'),
|
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'prefix_indexes' => true,
|
'prefix_indexes' => true,
|
||||||
'encrypt' => env('DB_ENCRYPT', 'no'),
|
|
||||||
//'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'true'),
|
|
||||||
'options' => [
|
|
||||||
'TrustServerCertificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'true'),
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user