Bug Report
| Q |
A |
| BC Break |
? |
| Version |
2.9.2 |
Summary
I just updated to version 2.9.2 of doctrine/dbal and started noticing that when running bin/console doctrine:migrations:diff it generated a new migration, then running bin/console doctrine:migrations:migrate followed by another bin/console doctrine:migrations:diff generates the exact same migration again.
This didn't happen in version 2.9.1
This is my first time opening an issue here, so if some info is missing which can help you, please let me know.
How to reproduce
Using 10.0.33-MariaDB
server_version is not defined in the configuration (doctrine.yaml).
Have a database table with the following format:
CREATE TABLE `enqueue` (
`id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '(DC2Type:guid)',
`published_at` bigint(20) NOT NULL,
`body` longtext COLLATE utf8mb4_unicode_ci,
`headers` longtext COLLATE utf8mb4_unicode_ci,
`properties` longtext COLLATE utf8mb4_unicode_ci,
`redelivered` tinyint(1) DEFAULT NULL,
`queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`priority` smallint(6) DEFAULT NULL,
`delayed_until` bigint(20) DEFAULT NULL,
`time_to_live` bigint(20) DEFAULT NULL,
`delivery_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '(DC2Type:guid)',
`redeliver_after` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_CFC35A68AA0BDFF712136921` (`redeliver_after`,`delivery_id`),
KEY `IDX_CFC35A68E0669C0612136921` (`time_to_live`,`delivery_id`),
KEY `IDX_CFC35A6862A6DC27E0D4FDE17FFD7F63121369211A065DF8BF396750` (`priority`,`published_at`,`queue`(191),`delivery_id`,`delayed_until`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Running bin/console doctrine:migrations:diff generates the following migration:
$this->addSql('DROP INDEX IDX_CFC35A6862A6DC27E0D4FDE17FFD7F63121369211A065DF8BF396750 ON enqueue');
$this->addSql('CREATE INDEX IDX_CFC35A6862A6DC27E0D4FDE17FFD7F63121369211A065DF8BF396750 ON enqueue (priority, published_at, queue, delivery_id, delayed_until, id)');
Notice the length of the varchar column queue is not specified in the index here, but gets set when executing the migration. Everytime a diff is generated, it doesn't see the length of this field in the index.
The entity class is something like this:
<?php
declare(strict_types=1);
/*********************************************************************************************/
/* DO NOT USE THIS ENTITY, IS HACK FOR https://github.com/php-enqueue/enqueue-dev/issues/271 */
/*********************************************************************************************/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\EnqueueRepository")
* @ORM\Table(
name="enqueue",
indexes={
@ORM\Index(name="IDX_CFC35A6862A6DC27E0D4FDE17FFD7F63121369211A065DF8BF396750", columns={"priority", "published_at", "queue", "delivery_id", "delayed_until", "id"}),
@ORM\Index(name="IDX_CFC35A68AA0BDFF712136921", columns={"redeliver_after", "delivery_id"}),
@ORM\Index(name="IDX_CFC35A68E0669C0612136921", columns={"time_to_live", "delivery_id"})
})
*/
class Enqueue
{
/**
* @ORM\Id()
* @ORM\Column(type="guid")
*/
private $id;
/**
* @ORM\Column(type="bigint")
*/
private $published_at;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $body;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $headers;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $properties;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $redelivered;
/**
* @ORM\Column(type="string", length=255)
*/
private $queue;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private $priority;
/**
* @ORM\Column(type="bigint", nullable=true)
*/
private $delayed_until;
/**
* @ORM\Column(type="bigint", nullable=true)
*/
private $time_to_live;
/**
* @ORM\Column(type="guid", nullable=true)
*/
private $delivery_id;
/**
* @ORM\Column(type="bigint", nullable=true)
*/
private $redeliver_after;
}
Thanks!
Bug Report
Summary
I just updated to version 2.9.2 of doctrine/dbal and started noticing that when running
bin/console doctrine:migrations:diffit generated a new migration, then runningbin/console doctrine:migrations:migratefollowed by anotherbin/console doctrine:migrations:diffgenerates the exact same migration again.This didn't happen in version 2.9.1
This is my first time opening an issue here, so if some info is missing which can help you, please let me know.
How to reproduce
Using 10.0.33-MariaDB
server_versionis not defined in the configuration (doctrine.yaml).Have a database table with the following format:
Running
bin/console doctrine:migrations:diffgenerates the following migration:Notice the length of the varchar column
queueis not specified in the index here, but gets set when executing the migration. Everytime a diff is generated, it doesn't see the length of this field in the index.The entity class is something like this:
Thanks!