简体   繁体   中英

Doctrine problems with the schema:update when using an array type

I am using the following orm description:

App\Entity\Journal:
type: entity
table: hpa_journal
repositoryClass: App\Repository\JournalRepository
id:
    id:
        type: integer
        id: true
        generator:
            strategy: AUTO
fields:
    longDescription:
        type: array
        nullable: true
        column: long_description

When I run a doctrine:schema:create it has no problems at all and creates the DB. But, when I run a schema:update I get the following error:

php bin/console doctrine:schema:update --dump-sql

 The following SQL statements will be executed:
     ALTER TABLE HPA_JOURNAL MODIFY (long_description CLOB DEFAULT NULL);

Which makes no sense since the CLOB is already as DEFAULT NULL , doctrine made it that way with the schema:create

When I run the schema:update --force to get rid of the message, I get the ORACLE error:

ORA-22859: invalid modification of columns

When doctrine compares the DB and the model it triggers a problem since in the DB the types "text", "array", "json_array",... are just CLOBS. In order to really make the difference you must add (if not made automatically like in my case) a proper comment:

COMMENT ON COLUMN HPA_JOURNAL.LONG_DESCRIPTION IS '(DC2Type:array)'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM