jekyll/jekyll-import

Drupal 8 url_alias table

joncamfield opened this issue · 2 comments

The jekyll Drupal8 importer appears to look for the url_alias table, which has been replaced by a new path_alias table, and the source field is now called path. Some Drupal-y links: https://www.drupal.org/project/xmlsitemap/issues/3117561 ; https://www.drupal.org/project/pathauto/issues/2696813

From the user's perspective, this generates errors such as

table url_alias doesn't exist
and
Unknown column 'source' in 'field list'

A quick solution for users is to (in the D8 DB) copy the path_alias table to a new url_alias table, and also rename the path column to source

An ideal solution would be a failure case to check for path_alias if url_alias is not found, and then pull using the updated field names.

(that said, thank you for the importer!)

parkr commented

From https://www.drupal.org/project/xmlsitemap/issues/3117561:

This should probably add a composer.json line locking this change to >= 8.8 since the opposite break will be true if someone tries to run the updated module in 8.7 :-/

Sounds to me like Drupal <8.7, use url_alias table and for Drupal >=8.8, use path_alias table. And they renamed a column. It's unfortunate that they changed the table name and renamed the column before Drupal 9.

Our code has this particular table referenced here:

def self.aliases_query(prefix)
"SELECT source, alias FROM #{prefix}url_alias WHERE source = ?"
end

And then processed here:

alias_query = aliases_query(prefix)
type = post[:type]
aliases_type = db[alias_query, "#{type}/#{node_id}"].all
aliases_node = db[alias_query, "node/#{node_id}"].all
aliases = aliases_type.concat aliases_node
aliases.push(:alias => "#{type}/#{node_id}")
aliases.push(:alias => "node/#{node_id}")

I think the best option here is to let the user either (1) select their Drupal minor version and we automatically switch or (2) we let them choose the table they want to use with helpful documentation indicating that <8.7 should use url_alias and >=8.8 should use path_alias.

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.