neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
260 stars 221 forks source link

Doctrine-Migration INCOHERENCES on fresh Neos setup of versions 5.x || 7.x || 8.x #3118

Open chkoeppel opened 3 years ago

chkoeppel commented 3 years ago

"Migration-incoherences" (mysql) on FRESH Neos installations (updated on 07 May 2023)


Neos "8.3.0 with PR-'patch'" -> ./flow doctrine:migrationgenerate => generated migration-class ----> see PR #4236 with 2 migrations ... (= PR not merged yet) ===> that would fix almost all, - except the leftover incoherence originated in package: https://github.com/neos/redirecthandler-databasestorage :-)


     $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');

Neos 8.3.0 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');

Neos 8.2.0 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');

Neos 8.1.2 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');

... see PR #3889 which improves here the first of those 3 issues ... :-)



Neos 8.0.1 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
    $this->addSql('DROP INDEX path ON neos_contentrepository_domain_model_nodedata');
    $this->addSql('CREATE INDEX pathindex ON neos_contentrepository_domain_model_nodedata (path(255))');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 7.3.1 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
    $this->addSql('DROP INDEX path ON neos_contentrepository_domain_model_nodedata');
    $this->addSql('CREATE INDEX pathindex ON neos_contentrepository_domain_model_nodedata (path(255))');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 7.2.3 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
    $this->addSql('DROP INDEX path ON neos_contentrepository_domain_model_nodedata');
    $this->addSql('CREATE INDEX pathindex ON neos_contentrepository_domain_model_nodedata (path(255))');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 7.1 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
    $this->addSql('DROP INDEX path ON neos_contentrepository_domain_model_nodedata');
    $this->addSql('CREATE INDEX pathindex ON neos_contentrepository_domain_model_nodedata (path(255))');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 7.0 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata RENAME INDEX path TO pathindex');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 5.3 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)'); 
    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata RENAME INDEX path TO pathindex');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 5.2 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata RENAME INDEX path TO pathindex');

    $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
    $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 5.1 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata RENAME INDEX path TO pathindex');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 5.0 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Neos 4.3 -> ./flow doctrine:migrationgenerate => generated migration-class


    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');

    $this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');


Steps to Reproduce

  1. composer create-project neos/neos-base-distribution neos-example (= fresh Neos setup with composer ... )
  2. ./flow doctrine:migrate ... to a fresh empty database (on each version above)
  3. ./flow doctrine:migrationgenerate
  4. check generated migration-class ...

Expected behavior

... an empty migration-class ... (shouldn't ...?)

Actual behavior

see migration-classes listed above ...

Affected Versions

SEE: Neos-Distribution Version mentioned on migration-classes listed above in the 'Description' ...

NOTE: I just wanted to mention this behavior for now, - as I suppose this to be important to get cleared once ... (??) Nevertheless I am aware that this needs deeper investigation to gain clear overview ... and fixes.

chkoeppel commented 3 years ago

see PR #2477 that should resolve the following one (?)

    $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');

See issue #3264 that mentions incorrect Doctrine mapping in Neos.Media ...

mhsdesign commented 1 year ago

wow thanks for the detailed writedown ;) ❤️

maybe this is related? https://github.com/neos/neos-development-collection/issues/2475

chkoeppel commented 1 year ago

Sure, this must be related ... :-)

So apparently 2 topics from 2019 have outlast history, - somehow ... ;-)

mhsdesign commented 1 year ago

So apparently 2 topics from 2019 have outlast history, - somehow ... ;-)

hehe yes as it seems ^^

Ill be on vacation soon so i cant currently take care of it, but ill try remember it for the next sprint ^^

Sorry for no feedback over such long time ^^

Happy Easter / Holiday for now!

kdambekalns commented 1 year ago