-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 BC-break regarding JsonArrayType #2855
Fix BC-break regarding JsonArrayType #2855
Conversation
18339f5
to
6937f25
Compare
*/ | ||
public function testComparatorShouldReturnFalseWhenLegacyJsonArrayColumnHasComment() | ||
{ | ||
if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this test also run on anything with TEXT support?
|
||
self::assertFalse($tableDiff); | ||
|
||
$this->_sm->dropTable('json_array_test'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be done in tearDown
or such: otherwise, a failure in this test can lead to other failures in colliding table names in tests
$comparator = new Comparator(); | ||
$tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); | ||
|
||
$this->_sm->dropTable('json_array_test'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be done in tearDown
or such: otherwise, a failure in this test can lead to other failures in colliding table names in tests
$comparator = new Comparator(); | ||
$tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); | ||
|
||
$this->_sm->dropTable('json_array_test'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be done in tearDown
or such: otherwise, a failure in this test can lead to other failures in colliding table names in tests
|
||
$comparator = new Comparator(); | ||
$tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_test'), $table); | ||
$this->_sm->dropTable('json_test'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be done in tearDown
or such: otherwise, a failure in this test can lead to other failures in colliding table names in tests
} | ||
|
||
$table = new Table('json_array_test'); | ||
$table->addColumn('id', 'integer'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop columns that aren't strictly required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure...
); | ||
|
||
$table = new Table('json_array_test'); | ||
$table->addColumn('id', 'integer'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop columns that aren't strictly required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure...
); | ||
|
||
$table = new Table('json_array_test'); | ||
$table->addColumn('id', 'integer'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop columns that aren't strictly required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure...
); | ||
|
||
$table = new Table('json_test'); | ||
$table->addColumn('id', 'integer'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop columns that aren't strictly required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure...
} | ||
|
||
$this->_conn->executeQuery( | ||
'CREATE TABLE json_test (id INT NOT NULL, parameters JSON NOT NULL, PRIMARY KEY(id))' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this because you need to reproduce half-migrated column definitions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, that ensures we won't break things baddly
6937f25
to
9058153
Compare
9058153
to
3b5c771
Compare
On 31d0128 we made JsonType the default one, which caused some unexpected results with the comparator. This tests validates that if users have a JSON column but are using the JsonArrayType we'll just add a comment to the column. Reference: doctrine#2782
And then we don't need to wait till v3 to not require comments on the JsonType.
3b5c771
to
c90b26e
Compare
Ok, I've found out that Oracle returns the modified columns using uppercase instead... tests updated and hopefully everything will work fine |
Requested changes have been applied
I know, this is REALLY nasty but that was the only way I've found to make it work properly.
c90b26e
to
104793c
Compare
As reported on #2782 (comment) we've introduced a BC-break on 2.6.x regarding the
json_array
type. This fixes it for good.