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 hardcoded varchar default length #5020

Merged

Conversation

mvorisek
Copy link
Contributor

Q A
Type improvement
BC Break no - the hardcoded value is default on all platforms
Fixed issues n/a

Summary

When AbstractPlatform::getVarcharDefaultLength is overriden, it must be honored AbstractPlatform::getCreateTableSQL.

@morozov
Copy link
Member

morozov commented Nov 23, 2021

This change doesn't belong to a patch release since it doesn't address any consumer-facing issues. At the same time, this method is deprecated in 3.2.x (#4724) and will trigger a deprecation notice.

@mvorisek mvorisek force-pushed the use_default_varchar_length_from_method branch from 1aa37b2 to 9d360fa Compare November 23, 2021 17:33
@mvorisek mvorisek changed the base branch from 3.1.x to 3.2.x November 23, 2021 17:34
@mvorisek
Copy link
Contributor Author

This change doesn't belong to a patch release since it doesn't address any consumer-facing issues. At the same time, this method is deprecated in 3.2.x (#4724) and will trigger a deprecation notice.

rebased onto 3.2.x

I use to override getVarcharDefaultLength in my code to support 255 characters by default on some platforms (instead of 255 bytes). What is the replacement to set a default VARCHAR length newly?

@morozov
Copy link
Member

morozov commented Nov 23, 2021

rebased onto 3.2.x

You'll have to change trigger() to triggerIfCalledFromOutside() in:

public function getVarcharDefaultLength()
{
Deprecation::trigger(

What is the replacement to set a default VARCHAR length newly?

There's no replacement for that. The column length will have to be specified explicitly for those platforms that require it (all except for SQLite and PostgreSQL). See #3263.

@mvorisek mvorisek force-pushed the use_default_varchar_length_from_method branch from 9d360fa to f253a0b Compare November 24, 2021 14:16
@mvorisek mvorisek force-pushed the use_default_varchar_length_from_method branch from f253a0b to 1a4b7e7 Compare November 24, 2021 14:17
@morozov morozov added this to the 3.2.0 milestone Nov 24, 2021
@morozov morozov merged commit 71a6f70 into doctrine:3.2.x Nov 24, 2021
@mvorisek mvorisek deleted the use_default_varchar_length_from_method branch November 24, 2021 16:44
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants