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 boolean type MSSQL. #20044

Merged
merged 2 commits into from
Oct 25, 2023
Merged

Conversation

terabytesoftw
Copy link
Member

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

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (778d708) 47.95% compared to head (e0ef41d) 47.94%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20044      +/-   ##
==========================================
- Coverage   47.95%   47.94%   -0.02%     
==========================================
  Files         445      445              
  Lines       43866    43877      +11     
==========================================
- Hits        21037    21036       -1     
- Misses      22829    22841      +12     
Files Coverage Δ
framework/db/mssql/Schema.php 45.69% <21.05%> (-0.58%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rob006
Copy link
Contributor

rob006 commented Oct 25, 2023

What is fixed here exactly?

@terabytesoftw
Copy link
Member Author

terabytesoftw commented Oct 25, 2023

In new versions of MSSQL, the tinyint and bit data types no longer have a size, so when declaring $this->boolean() in the migration, it won't function as intended. This change accommodates compatibility with older versions that still support specifying size for these data types, as well as with newer versions where tinyint always has a size of 3 and bit always has a size of 1.

https://learn.microsoft.com/en-us/sql/t-sql/data-types/bit-transact-sql?view=sql-server-ver16
https://learn.microsoft.com/en-us/sql/t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql?view=sql-server-ver16

if ($column->size === 1 && ($type === 'tinyint' || $type === 'bit')) {

@samdark samdark merged commit 9d3c71d into yiisoft:master Oct 25, 2023
47 of 49 checks passed
@samdark
Copy link
Member

samdark commented Oct 25, 2023

Thank you!

@samdark samdark added this to the 2.0.50 milestone Oct 25, 2023
@samdark samdark added the type:bug Bug label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants