skiptirengu / yii2-mssql-schema
Optimized Schema for Yii2 applications using mssql databases
Installs: 10 422
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 2
Requires
- php: >=5.6.0
- yiisoft/yii2: ~2.0.13
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2024-11-10 04:01:48 UTC
README
This extension provides an optimized Schema class for Yii2 applications using SQL Server databases, and also fixes several bugs of the current core mssql implementation.
It achieves a better performance by using the stored procedure sp_help instead of querying the system catalog for each table you're acessing. This cuts down the number of queries Yii executes to get information about your table from three to only one!
Requirements
- PHP >= 5.6
- SQL Server >= 2008
- PDO driver (pdo_dblib, pdo_sqlsrv, etc)
Installation
The preferred way to install this extension is through composer.
Either run
composer require "skiptirengu/yii2-mssql-schema:*"
or add
"skiptirengu/yii2-mssql-schema": "*"
to the require
section of your composer.json
file.
Usage
To use this extension, just change the database configuration of your application to match the following
// ... 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', // ... 'schemaMap' => [ // if you're using freetds + dblib 'dblib' => 'skiptirengu\mssql\Schema', // older MSSQL driver on MS Windows hosts 'mssql' => 'skiptirengu\mssql\Schema', // new ms driver for SQL Server // https://github.com/Microsoft/msphpsql 'sqlsrv' => 'skiptirengu\mssql\Schema', ] ] ]
and you're set!
TODO
- Backport this to PHP 5.4?
- Figure out a way to load table comments
License
Licensed under the incredibly permissive MIT license