I am trying to create migrations with doctrine:migrations:diff. the database is now allready in a well enough state, but when i try to at something (such as name shown below) it also keeps trying to change the foreign key.
But it keeps trying to change the FK key:
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE order_manager ADD name VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE orders RENAME INDEX fk_e6ab879d9395c3f3 TO IDX_E52FFDEE9395C3F3');
$this->addSql('ALTER TABLE orders RENAME INDEX fk_e6ab879dcbe4c936 TO IDX_E52FFDEECBE4C936');
}
Here is the entity class:
class Orders extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="orders", fetch="EAGER")
* @ORM\JoinColumn(name="customer_id", nullable=true)
*/
private $customer;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\OrderManager", inversedBy="orders", fetch="EAGER")
* @ORM\JoinColumn(name="order_manager_id", nullable=true)
*/
private $orderManager;
public function getId()
{
return $this->id;
}
public function getCustomer(): Customer
{
return $this->customer;
}
public function setCustomer(Customer $customer)
{
$this->customer = $customer;
}
public function getOrderManager(): orderManager
{
return $this->orderManager;
}
public function setOrderManager(orderManager $orderManager)
{
$this->orderManager = $orderManager;
}
}
When trying to do doctrine:migrations:migrate I get this error
An exception occurred while executing 'ALTER TABLE orders RENAME INDEX fk_e6ab879d9395c3f3 TO IDX_E52FFDEE9395C3F3':
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INDEX fk_e6ab879d9395c3f3 TO IDX_E52FFDEE9395C3F3' at line 1