Reputation: 13
I am using Symfony 6 and I created an entity using the command "php bin/console make:entity". But it was a test, so now I want to remove completely the entity (PHP class + SQL table).
How can I delete it properly ? Even if it was in production env. Because I read that we shouldn't run "php bin/console d:s:u --force" in production env.
Thanks
Upvotes: 1
Views: 3108
Reputation: 1534
Updating, adding or removing entities can be performed like this:
src/entity
.php bin/console doctrine:migrations:diff --allow-empty-diff
. (this will create the migration file in /migrations
, look at this and you will see the sql commands)php bin/console doctrine:migrations:migrate --allow-no-migration
. (this will run the migration file and update your db)php bin/console cache:clear
.I have added --allow-empty-diff
and --allow-no-migration
options, so if you are going to use a deployment script (for production), then these can be run all the time even if there are no differences or updates to your entities and no errors will be thrown.
Upvotes: 5