- Issue created by @mstrelan
- last update
over 1 year ago 29,878 pass, 2 fail - Merge request !4457Issue #3376421: Remove suboptimal path_alias__status index from path_alias table → (Closed) created by mstrelan
- Open on Drupal.org →Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - last update
over 1 year ago 29,879 pass, 1 fail - Open on Drupal.org →Environment: PHP 8.2 & MySQL 8
14:56 14:56 Queueing - Status changed to Needs review
over 1 year ago 3:21am 24 July 2023 - last update
over 1 year ago 29,879 pass - last update
over 1 year ago 29,879 pass - last update
over 1 year ago 29,879 pass - last update
over 1 year ago 29,879 pass - 🇬🇧United Kingdom catch
The patch looks good, I've kicked off test runs against pgsql and sqlite.
This would be the first hook_update_N() we've added to a patch release for a while, given it's a straight bugfix and the end result is just dropping the index, that's probably fine though.
- Status changed to RTBC
over 1 year ago 9:02am 24 July 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
One minor comment that could be fixed on commit
- 🇦🇺Australia mstrelan
The link in the comment is to the wrong issue anyway, so +1 for remove on commit.
- 🇨🇭Switzerland berdir Switzerland
Looks fine to me too. FWIW, the update could also be a post update since it doesn't alter the schema in any way that would conflict with loading or saving en entity.
- last update
over 1 year ago 29,880 pass - Status changed to Needs work
over 1 year ago 8:14am 25 July 2023 - 🇬🇧United Kingdom catch
I'm wondering about hook_update_N() vs. post_update a bit.
The update just does this:
$update_manager = \Drupal::service('entity.definition_update_manager'); $entity_type = $update_manager->getEntityType('path_alias'); $update_manager->updateEntityType($entity_type);
If we later introduced a change to path alias (extra column or whatever), the code here would add that column before any later update gets to run.
I think we need to do this update the long way, i.e. the "Updating an existing entity type when the update requires schema changes" method from https://www.drupal.org/node/3034742 →
Not because this update in itself will break anything, but because it will prevent another update from doing things the 'safe' way.
Or... maybe we can put the existing logic in a post update (because as @berdir notes it's safe to do it wherever), and then if there was a later schema change, that update would run first before we get to this one (and either drop the index as a side effect, or this one would still work).
In either case needs work for now.
- 🇦🇺Australia mstrelan
I think we need to do this update the long way, i.e. the "Updating an existing entity type when the update requires schema changes" method from https://www.drupal.org/node/3034742 →
I'm not seeing anything in there that would allow us to remove the index. I can alter the entity type definition but that doesn't help as the index is provided by the entity storage schema and I don't see any public methods to accessing the schema to drop indexes. Looks like the post update hook would be the only way.
- last update
over 1 year ago 29,881 pass - Status changed to Needs review
over 1 year ago 9:27am 25 July 2023 - Status changed to RTBC
over 1 year ago 10:05am 25 July 2023 - 🇬🇧United Kingdom catch
re #14 that was in the back of my mind but not fully formed, in that case post update looks good and probably the only option. Moving this back to RTBC.
- last update
over 1 year ago 29,883 pass -
larowlan →
committed 1f9798dd on 11.x
Issue #3376421 by mstrelan, catch, Berdir: Remove suboptimal...
-
larowlan →
committed 1f9798dd on 11.x
- Status changed to Fixed
over 1 year ago 10:32pm 26 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.
- 🇮🇳India shahin-raza Mumbai
The above patch is giving an issue while upgrading Drupal core version 10.0.9 to 10.2.3. I am using PostgreSQL database version 13.13.
Below is the issue, during drush updb:
Exception thrown while performing a schema update. constraint path_alias__path_alias__revision_id__key of relation "path_alias" does not exist same problem with drop_path_alias_status_index when upgrading from 10.2.2 to 10.2.4
PHP 8.3.8
MariaDB 10.11.6same problem with drop_path_alias_status_index when upgrading from 10.2.2 to 10.2.4
PHP 8.3.8
MariaDB 10.11.6- 🇵🇭Philippines bryanmanalo
Also experienced this, I tried using this script to install the path_alias update entity. However, not so sure if this is correct.
This will make the update db successful.
You can add this on hook_update_N or drush scr.
$update_manager = \Drupal::service('entity.definition_update_manager'); $path_alias = \Drupal::entityTypeManager()->getDefinition('path_alias'); // 1. Install the missing schema. $update_manager->installEntityType($path_alias); // 2. Manually remove the index, because the update does nothing since we // don't have a copy of the schema prior. $schema = \Drupal::database()->schema(); $table = 'path_alias'; if ($schema->indexExists($table, 'path_alias__status')) { $schema->dropIndex($table, 'path_alias__status'); \Drupal::messenger()->addStatus(t('The index "path_alias__status" has been removed from the table.')); } else { \Drupal::messenger()->addWarning(t('The index "path_alias__status" does not exist on the table.')); }