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

MySQLSchemaManager: Check expected database type for json columns only #6189

Merged
merged 2 commits into from Nov 2, 2023

Conversation

cgknx
Copy link
Contributor

@cgknx cgknx commented Oct 13, 2023

Q A
Type bug fix
Fixed issues #6185

Summary

Using the type from DC2Type comments masks the need to upgrade LONGTEXT columns to JSON so the underlying column type was also checked for commented columns.

Custom column types using a valid synonym for column type (e.g. NUMERIC for DECIMAL), trigger a false failure of this type test.

Restrict the check to json types only and add test case.

Using the type from DC2Type comments masks the need to upgrade LONGTEXT
columns to JSON so the underlying column type was also checked for
commented columns.

Custom column types using a valid synonym for column type (e.g. NUMERIC
for DECIMAL), trigger a false failure of this type test.

Restrict the check to json types only.

Add test case.

See bug doctrine#6185.
Copy link

@cs278 cs278 left a comment

Choose a reason for hiding this comment

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

Should fix my issue, I will test it next week.

*/
public function getMappedDatabaseTypes(AbstractPlatform $platform)
{
return ['point'];
Copy link

Choose a reason for hiding this comment

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

Is this meant to be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. No. Thanks for spotting. Now removed.

Remove getMappedDatabaseTypes() method included by mistake.
Copy link

@cs278 cs278 left a comment

Choose a reason for hiding this comment

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

Tested - fixes the bug I filed.

@derrabus derrabus merged commit 4134b86 into doctrine:3.7.x Nov 2, 2023
84 checks passed
@derrabus
Copy link
Member

derrabus commented Nov 2, 2023

Thank you.

@derrabus derrabus added this to the 3.7.2 milestone Nov 2, 2023
derrabus added a commit that referenced this pull request Nov 2, 2023
* 3.7.x:
  MySQLSchemaManager. Check expected database type for json columns only. (#6189)
  Make the type annotation for CompositeExpression::count more specific (#6188)
derrabus added a commit to derrabus/dbal that referenced this pull request Nov 3, 2023
* 3.8.x:
  Run tests on MySQL 8.2 (doctrine#6207)
  MySQLSchemaManager. Check expected database type for json columns only. (doctrine#6189)
  Make the type annotation for CompositeExpression::count more specific (doctrine#6188)
derrabus added a commit to derrabus/dbal that referenced this pull request Nov 5, 2023
* 3.8.x:
  Run tests on MySQL 8.2 (doctrine#6207)
  MySQLSchemaManager. Check expected database type for json columns only. (doctrine#6189)
  Make the type annotation for CompositeExpression::count more specific (doctrine#6188)
@derrabus derrabus changed the title MySQLSchemaManager. Check expected database type for json columns only. MySQLSchemaManager: Check expected database type for json columns only Nov 5, 2023
derrabus added a commit that referenced this pull request Nov 5, 2023
|      Q       |   A
|------------- | -----------
| Type         | improvement
| Fixed issues | Follows #6189

#### Summary

This PR improves the test added in #6189 by allowing it to run on other
platforms than MySQL/MariaDB and by using non-deprecated APIs only. This
should make it easier to merge this test and later changes to it up to
the 4.0.x branch.

I've skipped Oracle though because I currently don't have a local Oracle
setup to test against.
derrabus added a commit to derrabus/dbal that referenced this pull request Nov 5, 2023
* 3.8.x:
  Generalize CustomIntrospectionTest (doctrine#6210)
  Run tests on MySQL 8.2 (doctrine#6207)
  MySQLSchemaManager. Check expected database type for json columns only. (doctrine#6189)
  Make the type annotation for CompositeExpression::count more specific (doctrine#6188)
allan-simon pushed a commit to allan-simon/dbal that referenced this pull request Nov 13, 2023
…y. (doctrine#6189)

|      Q       |   A
|------------- | -----------
| Type         | bug fix
| Fixed issues | doctrine#6185

#### Summary

Using the type from DC2Type comments masks the need to upgrade LONGTEXT
columns to JSON so the underlying column type was also checked for
commented columns.

Custom column types using a valid synonym for column type (e.g. NUMERIC
for DECIMAL), trigger a false failure of this type test.

Restrict the check to json types only and add test case.
allan-simon pushed a commit to allan-simon/dbal that referenced this pull request Nov 13, 2023
|      Q       |   A
|------------- | -----------
| Type         | improvement
| Fixed issues | Follows doctrine#6189

#### Summary

This PR improves the test added in doctrine#6189 by allowing it to run on other
platforms than MySQL/MariaDB and by using non-deprecated APIs only. This
should make it easier to merge this test and later changes to it up to
the 4.0.x branch.

I've skipped Oracle though because I currently don't have a local Oracle
setup to test against.
@Padam87
Copy link

Padam87 commented Nov 17, 2023

Thank you @cgknx

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

Successfully merging this pull request may close these issues.

None yet

4 participants