backdrop-contrib / d2b_migrate

GNU General Public License v2.0
5 stars 6 forks source link

Unknown column 'langcode' (before Drupal database has been upgraded) #45

Open irinaz opened 6 months ago

irinaz commented 6 months ago

On some sites during upgrade we see message about 'langcode' in url_alias table. Similar bug filed already in core issue

D7 upgrade: Error in upgrade related to "redirect" and "user_roles" upgrade #6367

docwilmot commented 6 months ago

Should be fixed

irinaz commented 5 months ago

@docwilmot , I installed most recent version of D2B via project installer and I have another site that shows 'langcode' error in redirect table. I can send failing db to you directly for testing.

stpaultim commented 5 months ago

@docwilmot and @irinaz

I had this problem earlier this week on a site, the upgrade failed. I disabled the redirect module and then the upgrade worked. This is the same site in which I go the "no pending updates" problem and then uploaded the database directly.

I will try this upgrade again with same database and see if the problem is still there for me.

docwilmot commented 5 months ago

I made a change earlier that I expected would fix this, but I guess it didn't. So yes please send a sample db if you can, and also post the full error and at what point it actually occurs.

irinaz commented 5 months ago

@docwilmot , can this be related to https://github.com/backdrop/backdrop-issues/issues/5496#issuecomment-2053889335 ? I do not know which version of db some of sites are using when I work on an instance provided by a customer.

stpaultim commented 5 months ago

Trying upgrade again and getting this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'langcode' in 'where clause': SELECT redirect.rid AS rid FROM {redirect} redirect WHERE ( (source LIKE :db_condition_placeholder_0 ESCAPE '\') OR (source = :db_condition_placeholder_1) )AND (langcode IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) ; Array ( [:db_condition_placeholder_0] => home [:db_condition_placeholder_1] => [:db_condition_placeholder_2] => en [:db_condition_placeholder_3] => und )

image

stpaultim commented 5 months ago

FYI - I plan to share the database with @docwilmot if it would be helpful.

stpaultim commented 5 months ago

Chatting with @docwilmot in Zulip right now. Will summarize what I've found here.

For me, I'm getting this error if the Redirect module was enabled on the Drupal 7 site before exporting the database. If I disable the redirect module before exporting database, I don't get this error.

I did try, for potentially the wrong reasons, the following steps.

1) Created a new Backdrop CMS without any changes or modifications 2) Made sure the redirect module was enabled on the Drupal 7 site and exported the dabase. 3) Imported the Drupal 7 database directly into new Backdrop CMS site, without making any additional changes or prep for upgrade. 4) Ran core/update.php and got the same error as I documented above.

Again, if I disable redirect module before exporting database, I don't see this problem - at least regularly. I'm not sure if Redirect module is involved when Irina is doing this.

If I see this error again, with the Redirect module involved, I'll report it here.

For me, this error does kill the upgrade process and require one to start over from scratch.

irinaz commented 5 months ago

I am getting exactly same error on Pantheon 10.4.25-MariaDB-log

Error message

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'langcode' in 'where clause': SELECT redirect.`rid` AS `rid` FROM {redirect} redirect WHERE ( (`source` LIKE :db_condition_placeholder_0 ESCAPE '\\') OR (`source` = :db_condition_placeholder_1) )AND (`langcode` IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) ; Array ( [:db_condition_placeholder_0] => home [:db_condition_placeholder_1] => [:db_condition_placeholder_2] => en [:db_condition_placeholder_3] => und ) in redirect_load_by_source() (line 477 of /code/core/modules/redirect/redirect.module).
Warning: Invalid argument supplied for foreach() in backdrop_alter() (line 1178 of /code/core/includes/module.inc).
stpaultim commented 5 months ago

@irinaz Your error message also mentions the Redirect module.

I assume that this might be an error in the upgrade code for the redirect module? Does that make sense?

irinaz commented 4 months ago

@docwilmot , I was able to resolve this issue in the following steps

Can we add this workflow (deleting existing json files) to D2B? @hosef , thanks a lot for suggesting this during one of User Group meetings.

jenlampton commented 4 months ago

Have we considered using a second database to hold the un-upgraded Drupal database until after it has been upgraded to Backdrop?

We could also have alternate config storage, and keep the two in parallel until after the update has completed. Then switch the site from the operational Backdrop site over to the just-upgraded version. (or even continue to run them as multi-site)

irinaz commented 4 months ago

Yes, there was a detailed discussion about second database, and it is not an option for site builders. Alternative configuration storage idea sounds super good.