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

Fix bit type #723

Closed
wants to merge 1 commit into from
Closed

Fix bit type #723

wants to merge 1 commit into from

Conversation

Tigrov
Copy link
Member

@Tigrov Tigrov commented Jun 27, 2023

For yiisoft/db-pgsql

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues

@what-the-diff
Copy link

what-the-diff bot commented Jun 27, 2023

PR Summary

  • Inclusion of a New Case for TYPE_BIT
    The AbstractSchema.php file now includes a new case consideration for TYPE_BIT within the getColumnPhpType() method. This means that the system can now handle and interpret TYPE_BIT information when processing data.

  • Addition of TYPE_BIT Constant
    In the SchemaInterface.php file, a new constant named TYPE_BIT has been introduced. This constant will be used across the system wherever TYPE_BIT data types need to be referred or processed.

@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (25c1e46) 99.77% compared to head (55cc14f) 99.77%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #723   +/-   ##
=========================================
  Coverage     99.77%   99.77%           
  Complexity     1281     1281           
=========================================
  Files            63       63           
  Lines          3045     3046    +1     
=========================================
+ Hits           3038     3039    +1     
  Misses            7        7           
Impacted Files Coverage Δ
src/Schema/AbstractSchema.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -409,6 +409,7 @@ protected function getColumnPhpType(ColumnSchemaInterface $column): string
SchemaInterface::TYPE_SMALLINT => SchemaInterface::PHP_TYPE_INTEGER,
SchemaInterface::TYPE_INTEGER => SchemaInterface::PHP_TYPE_INTEGER,
SchemaInterface::TYPE_BIGINT => SchemaInterface::PHP_TYPE_INTEGER,
SchemaInterface::TYPE_BIT => SchemaInterface::PHP_TYPE_INTEGER,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In MSSQL BIT is 1, 0, or NULL only. Can it be problem?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be use name "BIT_STRING"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are only for yiisoft/db-pgsql

For yiisoft/db-mssql it is as before:

https://github.com/yiisoft/db-mssql/blob/master/src/Schema.php#L74C9-L74C38

'bit' => self::TYPE_SMALLINT,

I do not know any issues with type bit in MSSQL but if it is required it is possible to change it to 'bit' => self::TYPE_BIT, and cast bit value in ColumnSchema::dbTypecast() or ColumnSchema::phpTypecast().

@Tigrov
Copy link
Member Author

Tigrov commented Jul 6, 2023

Code moved to yiisoft/db-pgsql

@Tigrov Tigrov closed this Jul 6, 2023
@terabytesoftw
Copy link
Member

Thank you. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants