Skip to content

Generated columns added to migrations file every time - any way to tell the migration to ignore single fields?  #490

@gravitiq-cm

Description

@gravitiq-cm

I have a generated column in my entity

/**
 * @ORM\Column(type="boolean", columnDefinition="TINYINT(1) GENERATED ALWAYS AS (xyz) STORED", insertable=false, updatable=false)
 * @ORM\Ignore()
 */

This works fine. However, every time I run make:migration (even with no new changes) a new migration file is created with the details of the generated columns. E.g. something like this:

        $this->addSql('ALTER TABLE my_table ADD my_field TINYINT(1) GENERATED ALWAYS AS (xyz) STORED');

I guess this is because the migration diff cannot see details of the generated column?

Is there any way to
a) see/debug what the migration is comparing to what (to see if I just need to tweak the text in the columnDefinition)
b) to mark the generated column as "ignore during migration" so make:migration does not consider it when creating migrations
?

Metadata

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