Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
- 8.2
- 8.3
- 8.4
- 8.5

mssql:
- 2022-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master
with:
php: >-
['8.1', '8.2', '8.3', '8.4']
['8.1', '8.2', '8.3', '8.4', '8.5']
required-packages: >-
['db']
6 changes: 3 additions & 3 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- ubuntu-latest

php:
- 8.4
- 8.5

services:
mssql:
Expand Down Expand Up @@ -67,8 +67,8 @@ jobs:
ini-values: memory_limit=-1
coverage: pcov

- name: Update composer.
run: composer self-update
- name: Install Composer dependencies
uses: ramsey/composer-install@v3

- name: Install db.
uses: yiisoft/actions/install-packages@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector-cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
php: '8.4'
php: '8.5'
required-packages: >-
['db']
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- New #339: Add `IndexType` and `IndexMethod` classes (@Tigrov)
- Bug #343: Explicitly mark nullable parameters (@vjik)
- New #342, #405: Support JSON type (@Tigrov)
- Chg #344: Change supported PHP versions to `8.1 - 8.4` (@Tigrov)
- Chg #344, #418: Change supported PHP versions to `8.1 - 8.5` (@Tigrov, @vjik)
- Chg #344: Change return type of `Command::insertWithReturningPks()` method to `array|false` (@Tigrov)
- New #345: Add parameters `$ifExists` and `$cascade` to `CommandInterface::dropTable()` and
`DDLQueryBuilderInterface::dropTable()` methods (@vjik)
Expand Down Expand Up @@ -63,6 +63,7 @@
- Bug #408, #409: Add `identity` support in `Schema::loadResultColumn()` (@vjik)
- Chg #413: Throw exception on "unsigned" column usage (@vjik)
- New #415: Add enumeration column type support (@vjik)
- New #418: Trim dot in column default value normalization to prevent PHP 8.5+ warnings on large values (@vjik)

## 1.2.0 March 21, 2024

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Driver supports Microsoft SQL Server 2017 or higher.

## Requirements

- PHP 8.1 - 8.4.
- PHP 8.1 - 8.5.
- `pdo_sqlsrv` PHP extension.

## Installation
Expand Down
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@
}
],
"require": {
"php": "8.1 - 8.4",
"php": "8.1 - 8.5",
"ext-pdo": "*",
"yiisoft/db": "dev-master"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.3",
"friendsofphp/php-cs-fixer": "^3.89.1",
"maglnet/composer-require-checker": "^4.7.1",
"phpunit/phpunit": "^10.5.45",
"rector/rector": "^2.0.10",
"roave/infection-static-analysis-plugin": "^1.35",
"spatie/phpunit-watcher": "^1.24",
"vimeo/psalm": "^5.26.1 || ^6.8.8",
"vlucas/phpdotenv": "^5.6.1",
"yiisoft/aliases": "^2.0",
"yiisoft/psr-dummy-provider": "^1.0",
Expand All @@ -64,10 +63,17 @@
},
"files": ["tests/bootstrap.php"]
},
"extra": {
"bamarni-bin": {
"bin-links": true,
"target-directory": "tools",
"forward-command": true
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"infection/extension-installer": true,
"bamarni/composer-bin-plugin": true,
"composer/package-versions-deprecated": true
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/Column/ColumnFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ protected function normalizeNotNullDefaultValue(string $defaultValue, ColumnInte
return hex2bin(substr($defaultValue, 2));
}

if (preg_match('~^\((\d+)\.\)$~', $defaultValue, $matches) === 1) {
return $column->phpTypecast($matches[1]);
}

return parent::normalizeNotNullDefaultValue($defaultValue, $column);
}
}
3 changes: 3 additions & 0 deletions tests/ColumnFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PHPUnit\Framework\Attributes\DataProviderExternal;
use Yiisoft\Db\Mssql\Column\ColumnFactory;
use Yiisoft\Db\Mssql\Tests\Provider\ColumnFactoryProvider;
use Yiisoft\Db\Mssql\Tests\Support\IntegrationTestTrait;
use Yiisoft\Db\Schema\Column\ColumnInterface;
use Yiisoft\Db\Tests\Common\CommonColumnFactoryTest;

Expand All @@ -15,6 +16,8 @@
*/
final class ColumnFactoryTest extends CommonColumnFactoryTest
{
use IntegrationTestTrait;

#[DataProviderExternal(ColumnFactoryProvider::class, 'dbTypes')]
public function testFromDbType(string $dbType, string $expectedType, string $expectedInstanceOf): void
{
Expand Down
43 changes: 0 additions & 43 deletions tests/Type/BigIntTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,49 +82,6 @@ public function testDefaultValueWithInsert(): void
$db->createCommand()->dropTable('bigint_default')->execute();
}

/**
* Max value is `9223372036854775807`, but when the value is greater than `9223372036854775807` it is out of range
* and save as `9223372036854775807`.
*/
public function testMaxValue(): void
{
$db = $this->getSharedConnection();
$this->loadFixture(FixtureDump::TYPE_BIGINT);

$command = $db->createCommand();
$command->insert('bigint', ['Mybigint1' => '9223372036854775807', 'Mybigint2' => '0'])->execute();

$this->assertSame(
[
'id' => '1',
'Mybigint1' => '9223372036854775807',
'Mybigint2' => '0',
],
$command->setSql(
<<<SQL
SELECT * FROM bigint WHERE id = 1
SQL,
)->queryOne(),
);

$command->insert('bigint', ['Mybigint1' => '9223372036854775808', 'Mybigint2' => null])->execute();

$this->assertSame(
[
'id' => '2',
'Mybigint1' => '9223372036854775807',
'Mybigint2' => null,
],
$command->setSql(
<<<SQL
SELECT * FROM bigint WHERE id = 2
SQL,
)->queryOne(),
);

$db->createCommand()->dropTable('bigint')->execute();
}

/**
* Min value is `-9223372036854775808`, but when the value is less than `-9223372036854775808` it is out of range
* and save as `-9223372036854775808`.
Expand Down
2 changes: 2 additions & 0 deletions tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*/vendor
/*/composer.lock
10 changes: 10 additions & 0 deletions tools/infection/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"require-dev": {
"infection/infection": "^0.26 || ^0.31.9"
},
"config": {
"allow-plugins": {
"infection/extension-installer": true
}
}
}
5 changes: 5 additions & 0 deletions tools/psalm/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require-dev": {
"vimeo/psalm": "^5.26.1 || ^6.8.8"
}
}
Loading