Sebastian
Sebastian

Reputation: 250

Symfony2 doctrine:schema:update keeps updating

I've just added a new attribute in my model:

/**
* @ORM\Column(name="has_donation", type="boolean", options ={"default":false})
*/
private $hasDonation;

And then I tried running:

php app/console doctrine:schema:update --force 

which gave me the following result:

Updating database schema...
Database schema updated successfully! "1" queries were executed

The problem is that each time I run the schema:update command, I get the same result - without making any changes to my entities. Any idea why? Thanks!

Update Here's the out for php app/console doctrine:schema:update --dump-sql:

ALTER TABLE Clinic CHANGE has_donation has_donation TINYINT(1) DEFAULT '0' NOT NULL;

Upvotes: 1

Views: 2047

Answers (2)

Prisacari Dmitrii
Prisacari Dmitrii

Reputation: 2106

I can assume that this issue arises because of usage of illegal or irrelevant mapping information.

In case of the question author, the option "default":false was illegal.

I had same issue with code:

/**
 * @ORM\Column(
 *     type="boolean",
 *     nullable=false,
 *     options={"unsigned":true, "comment":"Is file uploaded manually?"}
 * )
 */
protected $manual = false;

In my case the option "unsigned":true was irrelevant. After removing this option, I got the code working.

Upvotes: 3

Tomas Votruba
Tomas Votruba

Reputation: 24298

First, try deleting cache.

Then, try php app/console doctrine:schema:update --dump-sql to see what updated. These options with "default": false differences are not recorded sometimes. At least on PostgreSQL we use.

You might need them to run them manually.


Tip from our workflow:

1) we setup entities

2) then run php app/console doctrine:schema:update --force

3) then run migrations that add there details that are not transformed to database

Upvotes: 2

Related Questions