Skip to content

Infer text column from string property when there is no length #9678

Open
@Tobion

Description

Feature Request

Q A
New Feature yes
RFC yes
BC Break yes

Summary

In DBAL 4.x the length will usually be required for varchar columns due to 3263
This is a good thing. But one thing might be unfortunate. When inferring the type from property types (feature #7939), string type is mapped to varchar. So when people use a string property but do not specify a length, it will work in Postgress (varchar without length equals text type) but will fail in MySQL and other RDBMS.
Given that this is a common case and people usually don't really care about the length of a string unless there are some specific requirements, I think this could be improved.

So I would suggest to change the inferred type for a string property to TEXT type when there a no length. If there is a length and it is supported by VARCHAR, it could stay to be varchar. This way inferred type is more clever depending on the length and it works without a failure by default.
As this would be a BC break given the column type changes in some cases, this could only be done in ORM 3.0 I assume.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions