Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
irinaz opened this issue Mar 18, 2024 · 13 comments
Open

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

irinaz opened this issue Mar 18, 2024 · 13 comments

Comments

@irinaz
Copy link
Contributor

irinaz commented Mar 18, 2024

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
Copy link
Member

Should be fixed

@irinaz
Copy link
Contributor Author

irinaz commented Apr 11, 2024

@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
Copy link
Member

@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
Copy link
Member

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
Copy link
Contributor Author

irinaz commented Apr 14, 2024

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

@stpaultim
Copy link
Member

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
Copy link
Member

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

@stpaultim
Copy link
Member

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
Copy link
Contributor Author

irinaz commented Apr 19, 2024

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
Copy link
Member

@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
Copy link
Contributor Author

irinaz commented May 10, 2024

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

  • Click last step of D2B d2b-migrate/restore
  • SFTP into config files directory and delete all json files
  • go back to core/update.php and complete update.

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
Copy link
Member

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)

@jenlampton jenlampton changed the title Unknown column 'langcode' Unknown column 'langcode' (before Drupal database has been upgraded) May 16, 2024
@irinaz
Copy link
Contributor Author

irinaz commented May 17, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants