Skip to content

Diff command generating unnecessary migration #1434

@KevinMarques

Description

@KevinMarques

Bug Report

Q A
BC Break no
Version 3.7.4
ORM 3.2.0
DBAL 4.0.3

Summary

When executing doctrine-migrations diff command, it generates a migration even though the entity and the database correspond to each other on datetime_immutable defined field.

Current behavior

Diff command generates unnecessary migration over and over again when already in sync:
$this->addSql('ALTER TABLE test_entity ALTER created_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE');

If I change the entity column type to 'datetime' instead of 'datetime_immutable' then it works properly, but I need to use the immutable type.

How to reproduce

Entity definition:

#[ORM\Entity]
#[ORM\Table(name: 'test_entity')]
class TestEntity
{
    #[ORM\Column(name: 'created_at', type: 'datetime_immutable')]
    private DateTimeImmutable $createdAt;
}

Execute:

  1. doctrine-migrations diff
  2. doctrine-migrations migrate
  3. doctrine-migrations diff

Expected behavior

No migration generated when already in sync using the datetime_immutable type column.

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