Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SqlServer database driver #6627

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c905191
Add SqlServer database driver
Chance-fyi Mar 14, 2024
c661c1f
Coroutines processing is now only supported for `pdo_odbc`
Chance-fyi Mar 25, 2024
aebb0e6
Add DatabaseSqlServerQueryGrammarTest.php
Chance-fyi Mar 25, 2024
4a6bc47
Add DatabaseConnectorTest.php
Chance-fyi Mar 25, 2024
46fe139
Add SqlServerBuilderTest.php
Chance-fyi Mar 25, 2024
3ddc495
fix testUnionAggregate
Chance-fyi Mar 26, 2024
33b4065
fix testInsertGetIdWithEmptyValues
Chance-fyi Mar 26, 2024
7b54422
fix test
Chance-fyi Mar 26, 2024
6e18511
fix testUpdateMethodWithJoinsOnSqlServer
Chance-fyi Mar 26, 2024
1842a43
fix testDeleteMethod
Chance-fyi Mar 26, 2024
4e4df11
fix testSqlServerLimitsAndOffsets
Chance-fyi Mar 26, 2024
bcf2bed
format
Chance-fyi Mar 26, 2024
ca3ef84
fix testBitwiseOperators
Chance-fyi Mar 26, 2024
5a9c055
fix testWhereJsonContainsKeySqlServer
Chance-fyi Mar 26, 2024
aa90349
fix testWhereJsonDoesntContainKeySqlServer
Chance-fyi Mar 26, 2024
8c11800
fix testUseIndexSqlServer testForceIndexSqlServer testIgnoreIndexSqlS…
Chance-fyi Mar 26, 2024
abe638d
Add DatabaseQueryBuilderTest.php
Chance-fyi Mar 26, 2024
a04f9c8
format
Chance-fyi Mar 26, 2024
fe928ff
fix testRenameColumnWithoutDoctrine
Chance-fyi Mar 26, 2024
bb7bb98
Add DatabaseSchemaBlueprintTest.php
Chance-fyi Mar 26, 2024
5df0433
Adding the `foreignId` method to `Blueprint`
Chance-fyi Mar 26, 2024
43e5dac
Add `$indexName` parameter to `constrained`
Chance-fyi Mar 26, 2024
ccb4599
Adding the `computed` method to `Blueprint`
Chance-fyi Mar 26, 2024
3fc05f5
Add DatabaseSqlServerSchemaGrammarTest.php
Chance-fyi Mar 26, 2024
3992d5a
fix test
Chance-fyi Mar 26, 2024
5500540
ci
Chance-fyi Mar 26, 2024
44b7aad
static analysis
Chance-fyi Mar 27, 2024
ef1a7da
update CHANGELOG-3.1.md
Chance-fyi Mar 27, 2024
71bc4a6
Merge branch 'master' into feature/database-sqlserver
Chance-fyi Mar 27, 2024
7c30ded
format
Chance-fyi Mar 27, 2024
932ca9e
format
Chance-fyi Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-3.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- [#6577](https://github.com/hyperf/hyperf/pull/6577) Support setup command traits before running.
- [#6579](https://github.com/hyperf/hyperf/pull/6579) Added `now()` and `today()` helper functions.
- [#6590](https://github.com/hyperf/hyperf/pull/6590) Added `--graceful` to migrateCommand.
- [#6627](https://github.com/hyperf/hyperf/pull/6627) Added `database-sqlserver` component.

## Fixed

Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"hyperf/database": "*",
"hyperf/database-pgsql": "*",
"hyperf/database-sqlite": "*",
"hyperf/database-sqlserver": "*",
"hyperf/db": "*",
"hyperf/db-connection": "*",
"hyperf/devtool": "*",
Expand Down Expand Up @@ -247,6 +248,7 @@
"Hyperf\\Database\\": "src/database/src/",
"Hyperf\\Database\\PgSQL\\": "src/database-pgsql/src/",
"Hyperf\\Database\\SQLite\\": "src/database-sqlite/src/",
"Hyperf\\Database\\Sqlsrv\\": "src/database-sqlserver/src/",
"Hyperf\\DbConnection\\": "src/db-connection/src/",
"Hyperf\\Devtool\\": "src/devtool/src/",
"Hyperf\\Di\\": "src/di/src/",
Expand Down Expand Up @@ -355,6 +357,7 @@
"HyperfTest\\Database\\": "src/database/tests/",
"HyperfTest\\Database\\PgSQL\\": "src/database-pgsql/tests/",
"HyperfTest\\Database\\SQLite\\": "src/database-sqlite/tests/",
"HyperfTest\\Database\\Sqlsrv\\": "src/database-sqlserver/tests/",
"HyperfTest\\DbConnection\\": "src/db-connection/tests/",
"HyperfTest\\Devtool\\": "src/devtool/tests/",
"HyperfTest\\Di\\": "src/di/tests/",
Expand Down Expand Up @@ -462,6 +465,7 @@
"Hyperf\\Dag\\ConfigProvider",
"Hyperf\\Database\\PgSQL\\ConfigProvider",
"Hyperf\\Database\\SQLite\\ConfigProvider",
"Hyperf\\Database\\Sqlsrv\\ConfigProvider",
"Hyperf\\DbConnection\\ConfigProvider",
"Hyperf\\Devtool\\ConfigProvider",
"Hyperf\\Di\\ConfigProvider",
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ parameters:
- %currentWorkingDirectory%/src/config-zookeeper/src/Client.php
- %currentWorkingDirectory%/src/database/*
- %currentWorkingDirectory%/src/database-pgsql/*
- %currentWorkingDirectory%/src/database-sqlserver/*
- %currentWorkingDirectory%/src/db/src/PgSQL/*
- %currentWorkingDirectory%/src/filesystem/*
- %currentWorkingDirectory%/src/graphql/*
Expand Down
2 changes: 2 additions & 0 deletions src/database-sqlserver/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tests export-ignore
/.github export-ignore
13 changes: 13 additions & 0 deletions src/database-sqlserver/.github/workflows/close-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Close Pull Request

on:
pull_request_target:
types: [ opened ]

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: "Hi, this is a READ-ONLY repository, please submit your PR on the https://github.com/hyperf/hyperf repository.<br><br> This Pull Request will close automatically.<br><br> Thanks! "
25 changes: 25 additions & 0 deletions src/database-sqlserver/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Release

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
21 changes: 21 additions & 0 deletions src/database-sqlserver/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Hyperf

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions src/database-sqlserver/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "hyperf/database-sqlserver",
"type": "library",
"description": "The sqlserver driver for hyperf/database.",
"license": "MIT",
"keywords": [
"php",
"hyperf",
"database",
"sqlserver"
],
"homepage": "https://hyperf.io",
"support": {
"docs": "https://hyperf.wiki",
"issues": "https://github.com/hyperf/hyperf/issues",
"pull-request": "https://github.com/hyperf/hyperf/pulls",
"source": "https://github.com/hyperf/hyperf"
},
"require": {
"php": ">=8.1",
"hyperf/database": "~3.1.0"
},
"autoload": {
"psr-4": {
"Hyperf\\Database\\Sqlsrv\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"HyperfTest\\Database\\Sqlsrv\\": "tests"
}
},
"config": {
"sort-packages": true
},
"extra": {
"hyperf": {
"config": "Hyperf\\Database\\Sqlsrv\\ConfigProvider"
}
}
}
31 changes: 31 additions & 0 deletions src/database-sqlserver/src/ConfigProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Database\Sqlsrv;

use Hyperf\Database\Sqlsrv\Connectors\SqlServerConnector;
use Hyperf\Database\Sqlsrv\Listener\RegisterConnectionListener;

class ConfigProvider
{
public function __invoke(): array
{
return [
'dependencies' => [
'db.connector.sqlsrv' => SqlServerConnector::class,
],
'listeners' => [
RegisterConnectionListener::class,
],
];
}
}