Do not use quotes to represent a boolean default #5108
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Representing boolean default as a string literal may cause false-positive diffs during platform-aware schema comparison if the platform doesn't support boolean columns natively (IBM DB2, Oracle, MySQL) and doesn't implement any hacks for introspection of boolean columns:
dbal/src/Platforms/AbstractMySQLPlatform.php
Line 1052 in 2b3504f
dbal/src/Platforms/OraclePlatform.php
Line 1148 in 2b3504f
See #5107 (comment) for more details.
The existing assertions that expect SQL like
TINYINT(1) DEFAULT '0'
are obviously wrong and were likely implemented by copy/pasting the actual value as expected.According to the functional tests, there are no cases where a boolean default would have to be represented as a string literal. All supported platforms use integer
0
and1
to represent boolean values. PostgreSQL supports booleans literalstrue
/false
.Note that the documentation for PostgreSQL 9.3 is the last version that mentions the support for quoted
'true'
and'false'
as valid boolean literals.