Issue
I am creating entities in the API Platform. Everytime I add a new entity or modify a field I run
docker-compose exec php bin/console doctrine:schema:update --force
to synchronize the schema. I faced no problems this far but after I created a datetime field and tried synchronizing I get a table already exists error
In AbstractPostgreSQLDriver.php line 66:
An exception occurred while executing 'CREATE SEQUENCE financial_statement_templates_definition_fstemplate_definition_id_seq INCREMENT BY 1 MINVALUE 1 START 1':
In PDOConnection.php line 83:
SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "financial_statement_templates_definition_fstemplate_definition_" already exists
In PDOConnection.php line 78:
SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "financial_statement_templates_definition_fstemplate_definition_" already exists
In the normal case I would have just dropped the tables and recreated it but since I am using the API Platform within docker I have no access to the database. Is there a way to resolve this?
Solution
Managed to figure this out. I dropped the database by running the following command
docker-compose exec php bin/console doctrine:database:drop --force
Then recreated the database using this statement from the command line
docker-compose exec php bin/console doctrine:database:create
Then updated the schema using this statement
docker-compose exec php bin/console doctrine:schema:update --force
Updating database schema...
6 queries were executed
[OK] Database schema updated successfully!
Answered By - sridhar pandurangiah
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.