I have a new installation of Symfony 2.8 with doctrine and MySQL 5.6.
After doing doctrine:schema:update --force
, I see how Database schema updated successfully! "x" queries were executed
Database schema updated successfully! "x" queries were executed
Here is my problem: even if I execute it several times, the doctrine always finds differences in the scheme.
With --dump-sql
I see that all of these queries are related to:
- adding NOT NULL to the row primary key
- adding NOT NULL to the datetime field
However, when I check my database, these columns already have NOT NULL.
Here is an example of a single property / column:
class MyEntity { private $code; ...
Here is the result of SHOW CREATE TABLE my_entity;
:
CREATE TABLE `my_entity` ( `cd_key` varchar(5) COLLATE utf8_unicode_ci NOT NULL, `label` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `number` int(11) NOT NULL, PRIMARY KEY (`cd_key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
And here the request doctrine tries to execute the doctrine:schema:update
command:
ALTER TABLE my_entity CHANGE cd_key cd_key VARCHAR(5) NOT NULL;
- I clear my Symfony cache between each command.
- I am trying to add
nullable=false
to the @Column annotation (an event if it is already defined as @Id), but no effect. - a
doctrine:schema:validate
does not find any display problem (other than synchronization). - I am trying to reset and recreate a complete database, but will fail.
Any ideas?
source share