Running bin/console doctrine:schema:update --force
again and again, it always output 39 queries executed
even after clearing cache/restarting php-fpm. So it always execute the same SQL requests again and again...
The SQL looks likes (from --dump-sql
)
ALTER TABLE apply_queue CHANGE cv_id cv_id INT DEFAULT NULL, CHANGE team_id team_id INT DEFAULT NULL;
....
And a lot of lines similar to this.
The ApplyQueue
class look like:
/**
* AppBundle\Entity\ApplyQueue.
*
* @ORM\Entity(repositoryClass="AppBundle\Entity\ApplyQueueRepository")
* @ORM\Table(name="apply_queue")
*/
class ApplyQueue
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Cv")
* @ORM\JoinColumn(name="cv_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected $cv;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Team")
* @ORM\JoinColumn(name="team_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected $team;
...
}
DBAL
config :
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
types:
json: Sonata\Doctrine\Types\JsonType
review_status: AppBundle\Model\Enum\ReviewStatusEnumType
mapping_types:
review_status: string
The structure of the table:
This is an "old" project that has been upgraded to Symfony 3.4 and MariaDB 10.2.
Thanks
If you are making a change in a SQL Server database, make sure the schema change is supported in Azure SQL Database. If schema changes are made in databases other than the database where the DDL trigger is created, the changes are not replicated. To avoid this issue, you can create DDL triggers to block changes on other endpoints.
In reality, when you’re working with one of these legacy databases, updating the schema without downtime usually requires creating a complete replica of your data so that you can operate in parallel. This allows you to update the schema in the replica and then gradually migrate your application over to it.
You can only make schema changes in the database where the DDL trigger is created. If you are making a change in a SQL Server database, make sure the schema change is supported in Azure SQL Database. If schema changes are made in databases other than the database where the DDL trigger is created, the changes are not replicated.
This example adds a filter to avoid replicating schema changes made under schema DataSync, because these are most likely made by the Data Sync service. Add more filters if you only want to replicate certain types of schema changes. You can also add more triggers to replicate other types of schema changes.
MariaDB 10.2 is not yet supported by Doctrine, causing this problem.
See linked PR : https://github.com/doctrine/dbal/pull/2825
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With