mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
doctrine:schema:drop --full-database does not remove some specific tables with names "sessions" and "rememberme_token" #6821
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jean553 on GitHub (Sep 2, 2021).
Bug Report
When I execute doctrine:schema:drop with the option --full-database, the tables created manually (not through Doctrine ORM) are not deleted. So the "full-database" is not deleted.
The tables are not deleted only if their names are:
sessionsrememberme_tokenSummary
I have two types of database assets/tables:
doctrine:migrations:generate) namedsessionsandrememberme_tokenThese two last tables are created according to the following Symfony documentations:
When I execute doctrine:schema:drop --full-database, all the tables created through Doctrine are correctly deleted. The two tables created manually are not deleted though.
This issue causes errors in automatic CI pipelines when trying to replay the whole migrations list after executing
doctrine:schema:drop --full-databaseas the tables we try to create already exists. A work-around is to add$this->addSql('DROP TABLE IF EXISTS rememberme_token')just before theCREATE TABLE.Current behavior
The full database content is not deleted when executing
doctrine:schema:drop --full-database.How to reproduce
PostgreSQL version: 12.7
1 - Execute
doctrine:migrations:generateto create a blank migration,2 - In the up() function, add the following code:
3 - In the down() function, add the following code:
4 - Execute
doctrine:migrations:migrateto create the table in your database,5 - Using PostgreSQL CLI, check the list of tables available; note that
rememberme_tokenhas been created,6 - Execute
doctrine:schema:dop --full-databaseto drop the content of the database7 - Using PostgreSQL CLI check the list of tables available; note that
rememberme_tokenis still there and has not been deleted;Expected behavior
When executing doctrine:schema:drop with the option --full-database, all tables (including those created manually) should be removed.
@eexit commented on GitHub (Sep 20, 2021):
Hi @jean553,
I found out that
sessionstable is black-listed as part of this CompilerPass, while therememberme_tokentable is probably filtered out in the doctrine.yml file under theschema_filterkey.It seems there's some on-going work to remove this CP and some features are already handled by Symfony code-base but not yet for the session PDO handler.
So far, the command is behaving as expected but maybe they should create a
--ignore-filterscommand flag that bypasses the filters altogether.