Installing File Entity 7.x-2.0-alpha1 on a sqlite3-backed site results in a critical error message. Some more details:

- Error occurs with both the 2.0-alpha1 and 2.0-dev version of File Entity.
- Error occurs whether enabling via the UI or via Drush (5.8).
- Using 7.23 core with standard installation profile. Enabling File Entity obviously requires ctools; this downloads and installs correctly beforehand
- No error when using MySQL DB.
- No error when using sqlite and upgrading from a previous version of File Entity, in my case 2.0-unstable7.
- SQlite DB is version 3
- OS is Ubuntu 12.04.2 LTS

Text of error message:

WD php: PDOException: SQLSTATE[HY000]: General error: 1 table "file_metadata" has more than one primary key: CREATE TABLE {file_metadata} (                             [error]
fid INTEGER PRIMARY KEY AUTOINCREMENT CHECK (fid>= 0),
name VARCHAR(255) NOT NULL,
value BLOB NULL DEFAULT NULL,
 PRIMARY KEY (name)
);
; Array
(
)
 in db_create_table() (line 2717 of /var/www/cst-sandbox/d723-fileentity/includes/database/database.inc).
PDOException: SQLSTATE[HY000]: General error: 1 table "file_metadata" has more than one primary key: CREATE TABLE {file_metadata} (
fid INTEGER PRIMARY KEY AUTOINCREMENT CHECK (fid>= 0),
name VARCHAR(255) NOT NULL,
value BLOB NULL DEFAULT NULL,
 PRIMARY KEY (name)
);
; Array
(
)
 in db_create_table() (line 2717 of /var/www/cst-sandbox/d723-fileentity/includes/database/database.inc).
Drush command terminated abnormally due to an unrecoverable error.

Comments

dave reid’s picture

Category: bug » support

Strange, why doesn't the SQLite driver support multiple primary keys... This is something the Schema API (hook_schema()) supports...

markgifford’s picture

More details in case it's relevant:

SQLite version: 3.7.9
SQLite extension [?]: PDO
PHP version: 5.3.10-1ubuntu3.6
dave reid’s picture

Ah, I think I know what's going wrong now. Let me upload a patch for you to test.

dave reid’s picture

Version: 7.x-2.0-alpha1 » 7.x-2.x-dev
Category: support » bug
Status: Active » Needs review
StatusFileSize
new1.68 KB

Please test the following patch.

markgifford’s picture

Patch applied to 7.x-2.0-alpha1, and I can confirm that fixed the issue on my system. File Entity installed cleanly using 7.23 standard profile and Drush 5.8. Thanks Dave!

markgifford’s picture

Whoops, probably should have applied patch to 7-2.x-dev in the first place rather than 7-2.x-alpha1. Anyway, also tested patch on -dev and can confirm it's successful.

aaron’s picture

Status: Needs review » Reviewed & tested by the community
dave reid’s picture

Status: Reviewed & tested by the community » Fixed
hswong3i’s picture

Status: Fixed » Needs work

In MySQL when update it face following error message:

SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key
hswong3i’s picture

I face similar issue when update message module schema which is originally serial primary key, and now that patch works, as your reference:

hswong3i’s picture

Status: Needs work » Needs review
StatusFileSize
new1.03 KB

Double check with 7.x-2.x + MySQL + following procedures:

  • git checkout 26ce21abcdac9c834c953b178f8c8533dfda8bf7
  • drush -y en file_entity
  • git apply file_entity-fix_file_metadata_primary_key_schema-2064305-11.patch
  • drush -y updb
killua99’s picture

Status: Needs review » Reviewed & tested by the community

This patch help me continue working .... idk if it correct or not, but this fix this bug.

dave reid’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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