dok55 / laravel-sybase
基于Sybase的Eloquent模块扩展,适用于Laravel 5.x。
2.4.6
2021-02-23 02:00 UTC
Requires
- php: ^7.0 || ^8.0
- doctrine/dbal: ^2.5
- illuminate/database: 5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*
- illuminate/support: 5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*
- dev-master
- 2.4.6
- 2.4.5
- 2.4.0
- 2.3.1
- 2.3.0
- 2.2.6
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0
- v1.x-dev
- 1.3.2
- 1.3.1
- 1.3
- 1.2.1
- 1.2.0.7
- 1.2.0.6
- 1.2.0.5
- 1.2.0.4
- 1.2.0.3
- 1.2.0.2
- 1.2.0.1
- 1.2
- 1.1
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0
- 0.3.0
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2
- 0.1.1
- 0.1.0
- dev-analysis-7a3WkN
- dev-fix-types
- dev-dev
This package is auto-updated.
Last update: 2024-09-23 09:53:09 UTC
README
- 启用使用多种类型的字段。
- 使用默认eloquent:与odbc和dblib兼容!
- 迁移!(进行中 - Work in Progress)
安装
在您的composer.json
文件的require部分添加以下内容
Laravel 5.1, 5.2, 5.3
"uepg/laravel-sybase": "~1.0"
Laravel 5.4, 5.5, 5.6, 5.7, 5.8, 6.x, 7.x, 8.x
"uepg/laravel-sybase": "~2.0"
执行以下命令更新包依赖项
composer update
将以下条目添加到config/app.php
文件中的providers数组中,Laravel 5.5或以上版本可选
Uepg\LaravelSybase\SybaseServiceProvider::class,
将以下条目添加到config/app.php
文件中的aliases数组中,Laravel 5.5或以上版本可选
'UepgBlueprint' => Uepg\LaravelSybase\Database\Schema\Blueprint::class,
将config/database.php
的默认驱动程序更新为sybase
或您自定义的odbc设置。以下是一个示例
<?php ... return [ ... 'connections' => [ ... 'sybase' => [ 'driver' => 'sqlsrv', 'host' => env('DB_HOST', 'sybase.myserver.com'), 'port' => env('DB_PORT', '5000'), 'database' => env('DB_DATABASE', 'mydatabase'), 'username' => env('DB_USERNAME', 'user'), 'password' => env('DB_PASSWORD', 'password'), 'charset' => 'utf8', 'prefix' => '', ], ... ], ... ]
将.env
更新为sybase
或您自定义的odbc设置。以下是一个示例
...
DB_CONNECTION=sybase
DB_HOST=sybase.myserver.com
DB_PORT=5000
DB_DATABASE=mydatabase
DB_USERNAME=user
DB_PASSWORD=password
...
配置freetds驱动程序
在Linux系统中,必须在freetds.conf
文件中将驱动程序版本设置为正确的字符集页面使用。
该文件通常位于/etc/freetds/freetds.conf
。在全局部分设置配置,如下例所示
[global]
# TDS protocol version
tds version = 5.0
设置为使用数字数据类型
在迁移文件中,您必须将use Illuminate\Database\Schema\Blueprint;
替换为use Uepg\LaravelSybase\Database\Schema\Blueprint;
。以下是一个示例
<?php use Illuminate\Support\Facades\Schema; // use Illuminate\Database\Schema\Blueprint; use Uepg\LaravelSybase\Database\Schema\Blueprint; // or "use UepgBlueprint as Blueprint" use Illuminate\Database\Migrations\Migration; class CreateTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('table_name', function (Blueprint $table) { $table->numeric('column_name', length, autoIncrement); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('table_name'); } }