Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to tell doctrine not to touch specific tables?

Every time I run doctrine:migrations:diff to generate migration for my changes it always includes removal of a few tables that are not handled by doctrine eg.:

$this->addSql('DROP TABLE messenger_messages');
$this->addSql('DROP TABLE monitoring');

Is there a way to tell doctrine that specific tables do not belong to him so doctrine will stop trying to drop them every time?

like image 254
HubertNNN Avatar asked Oct 15 '25 22:10

HubertNNN


1 Answers

You can find your answer in the docs : https://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html#manual-tables

Short answer : add prefix to your custom tables, then configure this prefix (for instance if your custom tables start by 't_') :

doctrine:
    dbal:
        schema_filter: ~^(?!t_)~
like image 75
Diabetic Nephropathy Avatar answered Oct 17 '25 13:10

Diabetic Nephropathy