Jump to content

Topic on Extension talk:OpenID Connect/Archive 2

update.php crashes with Error 1060: Duplicate column name 'oidc_id' when run again

3
Planetenxin (talkcontribs)
  • MW 1.39
  • OIDC 8.0.3
$wgOpenIDConnect_UseRealNameAsUserName = true;
$wgOpenIDConnect_MigrateUsersByEmail = true;

When running update.php more than once, it crashes as follows:

Modifying table openid_connect...Wikimedia\Rdbms\DBQueryError from line 1618 of /var/www/html/includes/libs/rdbms/database/Database.php: Error 1060: Duplicate column name 'oidc_id'
Function: Wikimedia\Rdbms\Database::sourceFile( /var/www/html/extensions/OpenIDConnect/includes/../sql/mysql/ChangePrimaryKey.sql )
Query: ALTER TABLE  `openid_connect`
 ADD  oidc_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
 DROP  PRIMARY KEY,
 ADD  PRIMARY KEY (oidc_id)
Olarp (talkcontribs)

I have the same problem. Works on MW 1.41.4, but when running the upgrade script after upgrading to 1.42.3 the error message is the same as yours.

Produkt Version
MediaWiki 1.41.4
PHP 8.1.31 (apache2handler)
ICU 72.1
MariaDB 11.4.4-MariaDB-ubu2404
LuaSandbox 4.1.2
Lua 5.1.5
Olarp (talkcontribs)

It's just crashing while doing weird stuff.

The database already has a oidc_id key that is set as primary key. So I don't know why it tries to recreate it. I managed to work around this error by editing the file

extensions/OpenIDConnect/sql/mysql/ChangePrimaryKey.sql

and commenting out the SQL statement so it won't run at all. Added double dashes to the last four lines (ALTER, ADD, DROP, ADD), as the first four have.

This made the upgrade.php run and I was able to upgrade to MediaWiki 1.42.3

Reply to "update.php crashes with Error 1060: Duplicate column name 'oidc_id' when run again"