Dbal: BUG: 'schema:update' is not adding/changing 'DC2Type' comment for updated fields

Created on 19 Nov 2018  路  2Comments  路  Source: doctrine/dbal

Bug Report

| Q | A
|------------ | ------
| BC Break | no
| Version orm | 2.6.2
| Version dbal | 2.8.0
| DB | Postgresql 9.6

Summary

It looks like this issue, but for sure it is not fixed in Orm 2.6.2:
https://github.com/doctrine/dbal/issues/3265

I have custom type:

class TextEncryptedType extends TextType {
    public function getName() {
        return TextEncryptedType::TEXT_ENCRYPTED;
    }

    public function requiresSQLCommentHint(AbstractPlatform $platform): bool {
        return true;
    }
}

When adding new field type="text_encrypted" to entity everything seems to be ok when executing doctrine:schema:update:

ALTER TABLE sometable ADD somecolumn TEXT DEFAULT NULL;
COMMENT ON COLUMN sometable.somecolumn  IS '(DC2Type:text_encrypted)';

But if I have already existing field type="text" and I will change it to type="text_encrypted" result is:

ALTER TABLE sometable ALTER somecolumn TYPE TEXT;
ALTER TABLE sometable ALTER somecolumn DROP DEFAULT;

DC2Type comment is not added. So doctrine:chema:update --dump-sql will always schow above alter commands.
Same thing is when you try to do text_encrypted -> text (comment is not removed) or text_encrypted -> string_encrypted (comment is not updated - yes, I created another custom type to test that).

So it looks like comment hints are added when creating field, but never updated/removed even when they should.

Bug Missing Tests Schema Schema Comparison Schema Managers Type Mapping Types

Most helpful comment

@jifer seems valid, but nobody worked on it.

All 2 comments

May I ask why this is completely ignored?

@jifer seems valid, but nobody worked on it.

Was this page helpful?
0 / 5 - 0 ratings