localgovdrupal / localgov_geo

Entity for storing Geographic information, addresses, and areas; extensible types and plugable backends with defaults to start.
2 stars 1 forks source link

Fix #91. Don't re-run updates on sites with config in their sync folder. #92

Closed ekes closed 1 year ago

ekes commented 1 year ago

Add drush deploy function to automatically or manually update content entities after configuration has been sync'd.

andybroomfield commented 1 year ago

I'm now seeing the following on drush cim, going to investigate further.

There were errors validating the config synchronization.
Entity type mismatch on rename. localgov_geo_type not equal to for existing configuration localgov_geo.localgov_geo_type.parking_zone and staged configuration geo_entity.geo_entity_type.parking_zone.

andybroomfield commented 1 year ago

So the parking zones geo_entitiy and localgov_geo are now getting the same UUID...?

Adnan-cds commented 1 year ago

Code looks good. But I am having a different kind of error during the drush deploy phase:

...
>  [notice] Update started: user_update_10000                                     
>  [error]  Route "entity.filter_format.edit_form" does not exist.                
>  [error]  Update failed: user_update_10000                                      
[error]  Update aborted by: user_update_10000                                    
[error]  Finished performing updates.

The entity.filter_format.edit_form route is declared in the filter module, so not sure why that's not found. Very strange.

andybroomfield commented 1 year ago

I'm also now getting an error when viewing geo entity pages (rare but happens)

Error: Call to a member function getColumns() on bool in Drupal\Core\Entity\Query\Sql\Tables->addField() (line 246 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php). Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 176) Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 81) Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 74) Drupal\preview_link\PreviewLinkHost->hasPreviewLinks(Object) (Line: 82) Drupal\preview_link\Access\PreviewLinkCanonicalRerouteAccessCheck->access(Object) call_user_func_array(Array, Array) (Line: 160) Drupal\Core\Access\AccessManager->performCheck('access_check.preview_link.canonical_rerouter', Object) (Line: 136) Drupal\Core\Access\AccessManager->check(Object, Object, Object, 1) (Line: 113) Drupal\Core\Access\AccessManager->checkRequest(Object, Object, 1) (Line: 107) Drupal\Core\Routing\AccessAwareRouter->checkAccess(Object) (Line: 92) Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object) (Line: 105) Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object, 'kernel.request', Object) call_user_func(Array, Object, 'kernel.request', Object) (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 158) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Hmm... Maybe theres more going on in the DB updates, though its strange as a config sync should be creating the bundles and fields just the same.

andybroomfield commented 1 year ago

I have now managed to get the import working with a combined branch of this branch, display migrations in #90, and the patch in Error when trying to edit an existing geo entity in an entity browser.

To get around the same UUIID on config import, I amended localgov_geo_update_update_8002 update with

    if (empty($geo_type)) {
      unset($geo_type_values['uuid']);
      unset($geo_type_values['_core']);
      $geo_type = GeoEntityType::create($geo_type_values);
    }

This works when I do drush updb -y and drush cex. Then on a DB with the current Drupal 9 site I can go drush updb, see the skipped geos. Then do drush cr and drush cim and the import then works with drush deploy:hook.

ekes commented 1 year ago

To get around the same UUIID on config import, I amended localgov_geo_update_update_8002 update

I don't quite understand this one. You shouldn't be running 8002 more than once?

ekes commented 1 year ago

@Adnan-cds

[error] Update aborted by: user_update_10000

Can we assume this isn't related to this issue. Like shouldn't stop us merging this one?

Adnan-cds commented 1 year ago

Can we assume this isn't related to this issue.

Yes, you can assume so :)

andybroomfield commented 1 year ago

I don't quite understand this one. You shouldn't be running 8002 more than once?

It's only run once, but you end up with both a localgov_geo_type.parking_zones and geo_entity_type.parking_zones with the same UUID.

finnlewis commented 1 year ago

@andybroomfield might have another commit to push back here to help

ekes commented 1 year ago

Merged into #90 we'll test that.