doctrine / DoctrineMigrationsBundle

Symfony integration for the doctrine/migrations library
MIT License
4.21k stars 214 forks source link

doctrine:migrations:diff generates DROP SEQUENCE messenger_messages_id_seq #461

Open Gemorroj opened 2 years ago

Gemorroj commented 2 years ago

After run doctrine:migrations:diff it generates

$this->addSql('DROP SEQUENCE schema.messenger_messages_id_seq CASCADE');

It bug relates to https://github.com/doctrine/DoctrineMigrationsBundle/issues/355 but the solution schema_filter: ~^(?!messenger_messages)~ doesn't help

im use postgres

murman-lexus commented 2 years ago

Hi! I have the same problem.

I hope problem with schema i'm tryed to change _myschema -> public and problem was solved, but I need use schema....

brettins commented 2 years ago

I'm also experiencing this. Every migration diff tries to drop some sequence tokens and I don't know what changed other than upgrading to the latest doctrine. Also in postgres.

florianajir commented 2 years ago

On my setup at each doctrine:migration:diff it adds me twice the lines creating the table messenger_messages

BernardA commented 2 years ago

I do have the same issue. I reported it on this related issue. .

Not only does it drop the sequences on up, but it also recreates them on down and additionally recreates the schemas.

Note that the issue of dropping SEQUENCES only happens when there's a custom SCHEMA.

The full code is available on this repository.

MkLHX commented 1 year ago

Hi there,

Still encountering the issue in my project and I need to use multiple schemas on PostgreSQL.

My project stack is as follows:

SF 6.1.12 PHP 8.1.9 "doctrine/doctrine-bundle": "^2.7", "avaibooksports/doctrine-migrations-multiple-database-bundle": "^0.3.4",

4 Entity Managers/Connection 4 PostgreSQL databases on docker postgis/postgis:14-3.3

When I apply a migration on all or one database, with custom schemas, the table's sequences are dropped.

I really can't move custom schemas tables to the public schema to much work is already done with custom schemas.

Did you find any workaround to manage migrations and keep sequences when applied?

florianajir commented 1 year ago

4 Entity Managers/Connection 4 PostgreSQL databases on docker postgis/postgis:14-3.3

Having the issue using postgis / docker too, maybe it is related