https://github.com/hyperf/database-pgsql-incubator
https://github.com/hyperf/database-pgsql-incubator
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hyperf/database-pgsql-incubator
- Owner: hyperf
- License: mit
- Archived: true
- Created: 2022-02-17T09:32:53.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-14T07:24:11.000Z (about 3 years ago)
- Last Synced: 2025-01-16T14:47:00.745Z (about 1 year ago)
- Language: PHP
- Size: 77.1 KB
- Stars: 13
- Watchers: 5
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PgSQL driver for Hyperf Database Component
## 安装
> hyperf/database 组件版本必须大于等于 v2.2.26
```
composer require hyperf/database-pgsql-incubator
```
## 配置
修改 `autoload/database.php` 配置
```php
[
'driver' => 'pgsql',
'host' => '127.0.0.1',
'database' => 'hyperf',
'port' => 5435,
'username' => 'postgres',
'password' => "",
'charset' => env('DB_CHARSET', 'utf8'),
'collation' => env('DB_COLLATION', 'utf8_unicode_ci'),
'prefix' => '',
'schema' => 'public',
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60),
],
'commands' => [
'gen:model' => [
'path' => 'app/Model',
'force_casts' => false,
'inheritance' => 'Model',
'refresh_fillable' => true
],
],
],
'pgsql-swoole' => [
'driver' => 'pgsql-swoole',
'host' => '127.0.0.1',
'database' => 'hyperf',
'port' => 5435,
'username' => 'postgres',
'password' => "",
'charset' => env('DB_CHARSET', 'utf8'),
'collation' => env('DB_COLLATION', 'utf8_unicode_ci'),
'prefix' => '',
'schema' => 'public',
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60),
],
'commands' => [
'gen:model' => [
'path' => 'app/Model',
'force_casts' => false,
'inheritance' => 'Model',
'refresh_fillable' => true
],
],
],
];
```
## 使用
目前增删改查orm,支持了pdo_pgsql和swoole/ext-postgresql双支持,由driver区分。迁移功能目前仅支持pdo,请注意配置和你的驱动是否安装