I'm using postgresql in a Symfony2 proyect with Postgis configured in Mac (not sure if that last one makes any difference).
The problem is that validating my schema AFTER running
doctrine:schema:update --force
will result on this error:
[Mapping] OK - The mapping files are correct.
[Database] FAIL - The database schema is not in sync with the current mapping file.
When updating again, Doctrine will try to add everything again, failing of course.
Thanks for the help.
EDIT: result for app/console --ansi doctrine:schema:update --dump-sql
ALTER T
ABLE actions ADD id VARCHAR(255) NOT NULL;
ALTER TABLE actions ADD display VARCHAR(255) NOT NULL;
ALTER TABLE actions ADD description VARCHAR(255) DEFAULT NULL;
ALTER TABLE actions ADD PRIMARY KEY (id);
-- lots more tables..
ALTER TABLE subclassifications ADD PRIMARY KEY (id);
ALTER TABLE users ADD id INT NOT NULL;
ALTER TABLE users ADD company_id INT DEFAULT NULL;
ALTER TABLE users ADD profile_id INT DEFAULT NULL;
ALTER TABLE users ADD name VARCHAR(255) NOT NULL;
ALTER TABLE users ADD password VARCHAR(255) NOT NULL;
ALTER TABLE users ADD salt VARCHAR(255) NOT NULL;
ALTER TABLE users ADD email VARCHAR(255) NOT NULL;
ALTER TABLE users ADD state INT NOT NULL;
ALTER TABLE users ADD accessCode INT NOT NULL;
ALTER TABLE users ADD CONSTRAINT FK_1483A5E9979B1AD6 FOREIGN KEY (company_id) REFERENCES companies (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;
ALTER TABLE users ADD CONSTRAINT FK_1483A5E9CCFA12B8 FOREIGN KEY (profile_id) REFERENCES profiles (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE;
CREATE INDEX IDX_1483A5E9979B1AD6 ON users (company_id);
CREATE INDEX IDX_1483A5E9CCFA12B8 ON users (profile_id);
ALTER TABLE users ADD PRIMARY KEY (id);
The point here is that the same dump will work the first time, but when making any change, the dump should be only the incremental changes, not the complete database.
doctrine:schema:update --dump-sql?