Skip to content

Commit

Permalink
Update bit type (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov authored Aug 8, 2024
1 parent e4795a9 commit 56becb5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Chg #348: Replace call of `SchemaInterface::getRawTableName()` to `QuoterInterface::getRawTableName()` (@Tigrov)
- Enh #349: Add method chaining for column classes (@Tigrov)
- Enh #350: Add array overlaps and JSON overlaps condition builders (@Tigrov)
- Enh #353: Update `bit` type according to main PR yiisoft/db#860 (@Tigrov)

## 1.3.0 March 21, 2024

Expand Down
2 changes: 1 addition & 1 deletion src/Column/ArrayColumnSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getColumn(): ColumnSchemaInterface
$phpType = $this->getPhpType();

$this->column = match ($type) {
Schema::TYPE_BIT => new BitColumnSchema($type, $phpType),
SchemaInterface::TYPE_BIT => new BitColumnSchema($type, $phpType),
Schema::TYPE_STRUCTURED => new StructuredColumnSchema($type, $phpType),
SchemaInterface::TYPE_BIGINT => PHP_INT_SIZE !== 8
? new BigIntColumnSchema($type, $phpType)
Expand Down
13 changes: 2 additions & 11 deletions src/Column/BitColumnSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@
namespace Yiisoft\Db\Pgsql\Column;

use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Pgsql\Schema;
use Yiisoft\Db\Schema\Column\AbstractColumnSchema;
use Yiisoft\Db\Schema\SchemaInterface;
use Yiisoft\Db\Schema\Column\BitColumnSchema as BaseBitColumnSchema;

use function bindec;
use function decbin;
use function gettype;
use function str_pad;

final class BitColumnSchema extends AbstractColumnSchema
final class BitColumnSchema extends BaseBitColumnSchema
{
public function __construct(
string $type = Schema::TYPE_BIT,
string|null $phpType = SchemaInterface::PHP_TYPE_INTEGER,
) {
parent::__construct($type, $phpType);
}

/** @psalm-suppress RedundantCast */
public function dbTypecast(mixed $value): string|ExpressionInterface|null
{
Expand Down
4 changes: 0 additions & 4 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@
*/
final class Schema extends AbstractPdoSchema
{
/**
* Define the abstract column type as `bit`.
*/
public const TYPE_BIT = 'bit';
/**
* Define the abstract column type as `array`.
*/
Expand Down

0 comments on commit 56becb5

Please sign in to comment.