For some reason when I generate migration using
php app/console doctrine:migrations:diff
I get weird names for constrains & indexes like FK_FFE561C6BE3BD8D4 & IDX_FFE561C6BE3BD8D4:
$this->addSql("ALTER TABLE agent_task ADD agentConfig_id INT UNSIGNED DEFAULT NULL, DROP agent_id");
$this->addSql("ALTER TABLE agent_task ADD CONSTRAINT FK_FFE561C6BE3BD8D4 FOREIGN KEY (agentConfig_id) REFERENCES agent_config (id)");
$this->addSql("CREATE INDEX IDX_FFE561C6BE3BD8D4 ON agent_task (agentConfig_id)");
The entity code snippet:
/**
* @var AgentConfig
*
* @ORM\ManyToOne(targetEntity="AgentConfig",inversedBy="agentTasks")
* @ORM\JoinColumn(name="agent_config_id", referencedColumnName="id")
*/
private $agentConfig;
Is there any way to define the names for those?
UPDATE
I tried indexes, but it didn't help.
/**
* AgentTaskConfig
*
* @ORM\Table(name="agent_task_config", indexes={@ORM\index(name="agent_task_config_task_id", columns={"task_id"})})
* @ORM\Entity
*/
class AgentTaskConfig
Still happening:
$this->addSql("ALTER TABLE agent_task_config DROP FOREIGN KEY fk_agent_task_id");
$this->addSql("ALTER TABLE agent_task_config ADD CONSTRAINT FK_7FEDF0EF8DB60186 FOREIGN KEY (task_id) REFERENCES agent_task (id)");