Hi,
I have recently updated from Drupal core 7.0 to Drupal core 7.2, then ran a update.php script where I discovered that this update needs several database changes, unfortunately two of them did not run smoothly. They are "comment module 7008 - Update database to match Drupal 7 schema." and "user module 7016 - Update the database to match the schema." with error messages:

The following updates returned messages
user module
Update #7016
Failed: PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]An explicit DROP INDEX is not allowed on index 'users.users_pkey'. It is being used for PRIMARY KEY constraint enforcement.: DROP INDEX [users_pkey] ON [{users}]; Array ( ) in function db_change_field() (row: 2944 in file C:\inetpub\web\SITE\drupal\includes\database\database.inc).

comment module
Update #7008
Failed: PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Object 'comment.status' cannot be renamed because the object participates in enforced dependencies.: EXEC sp_rename :old, :new, :type; Array ( [:old] => comment.status [:new] => status_old [:type] => COLUMN ) in function db_change_field() (row: 2944 in file C:\inetpub\web\SITE\drupal\includes\database\database.inc).

Thanks for looking at it.

Comments

Damien Tournoud’s picture

Version: 7.x-1.0-rc3 » 7.x-1.x-dev
Component: Data modification » Schema handling
Priority: Normal » Major

Just triaging for now.

Damien Tournoud’s picture

Those are two different issues:

  • user_update_7016() modifies a primary key and we don't properly account for this case
  • comment_update_7008() modifies an unsigned column, and for some reason we fail to drop the related constraint before renaming the column
Damien Tournoud’s picture

Status: Active » Fixed

This is now fixed by e230b9, bb7f5b and 0a86de. Tests are in fcd1d5.

goldramgb’s picture

Can someone give some direction to a total newbie to drupal. I have the same error when I did the upgrade, I found this Issue and downloaded the patch but it readme.txt points to the web site for installation instructions but looks like that is for a new installation. I'm sure this update is easy for someone that knows how to do it, but for me it makes no sense.

Erythros’s picture

The best way will be to just delete the old module (even folder in includes/database), download the module from drupal.org/project/sqlsrv and copy to module and database folders as is written in help txt.

Of course, thanks for patching the module.

goldramgb’s picture

Erythros Thanks for the reply. As far as I can tell I don't have a SQLSRV.module installed. I did replace the old files in the includes/database folder with the new ones, but I just got an error( I didn't write it down though) I replaces the new files with the old file and the web site started working again. But now if I try to clear the caches I get the following error.

PDOException: SQLSTATE[23000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Violation of PRIMARY KEY constraint 'registry_pkey'. Cannot insert duplicate key in object 'dbo.registry'. in _registry_parse_file() (line 179 of C:\Drupal\tscobb\includes\registry.inc).

I looked but couldn't fine a help txt anywhere, did I miss it? In the readme that was in the download it just gave the URL for the web site.

Should I install a new module with the .module file from the download, and replace the old files from the includes/database folder?
Thanks for your time. Bill

Automatically closed -- issue fixed for 2 weeks with no activity.