What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi all, we have updated various packages including spryker/acl and are running into an error with t

U01DH3E31C1
U01DH3E31C1 Posts: 23 🧑🏻‍🚀 - Cadet

Hi all,
we have updated various packages including spryker/acl and are running into an error with the migrations now:

Migrate database
Executing migration PropelMigration_1624522485 up
Propel\Runtime\Exception\RuntimeException - Exception: <error>Failed to execute SQL "DROP INDEX `spy_acl_groups_has_roles-fi_acl_group` ON `spy_acl_groups_has_roles`". Aborting migration.</error> 
in /data/vendor/propel/propel/src/Propel/Generator/Command/MigrationMigrateCommand.php (149)

The UP-migration looks like this:

# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;

DROP INDEX `spy_acl_groups_has_roles-fi_acl_group` ON `spy_acl_groups_has_roles`;

CREATE INDEX `spy_acl_groups_has_roles-fi_acl_role` ON `spy_acl_groups_has_roles` (`fk_acl_role`);

DROP INDEX `spy_acl_user_has_group-fi_acl_group` ON `spy_acl_user_has_group`;

CREATE INDEX `spy_acl_user_has_group-fi_user` ON `spy_acl_user_has_group` (`fk_user`);

Comments

  • U01DH3E31C1
    U01DH3E31C1 Posts: 23 🧑🏻‍🚀 - Cadet

    The migration is switching the index to another foreign key and fails due to existing data, regardless of the SET FOREIGN_KEY_CHECKS = 0 .

    Can you please assist on how to handle this? Obviously using mysql as db engine.

  • U01DH3E31C1
    U01DH3E31C1 Posts: 23 🧑🏻‍🚀 - Cadet
    edited June 2021

    Got it:
    Fix the *.schema.xml files in src/Pyz/Zed/IndexGenerator/Persistence/Propel/Schema and possibly add the missing index definitions for spy_acl_groups_has_roles and spy_acl_user_has_group.

  • U01DH3E31C1
    U01DH3E31C1 Posts: 23 🧑🏻‍🚀 - Cadet

    The console commands say that these files are relevant for postgres only, but the obviously are relevant for mysql too.

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,051 ⚖️ - Guardians (admin)

    The schema files are there to be database system independent - so yes, it is used for mysql and postgresql