Closed (fixed)
Project:
Domain
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Jan 2012 at 08:58 UTC
Updated:
26 Mar 2012 at 19:10 UTC
Trying to install DA via Drush on a site using a SQLite database results in the following:
~> drush --uri=http://spaces.test/ en domain
The following extensions will be enabled: domain
Do you really want to continue? (y/n): y
WD php: PDOException: SQLSTATE[HY000]: General error: 1 table "domain_export" has more than one primary key: [error]
CREATE TABLE {domain_export} (
domain_id INTEGER PRIMARY KEY AUTOINCREMENT,
machine_name VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY (machine_name)
);
; Array
(
)
in db_create_table() (line 2684 of /Users/garrett/Sites/spaces.test/www/includes/database/database.inc).
Since this is currently happening even in the 7.x-3.3 release but there don't appear to be any other issues about this, I'm betting this isn't a problem when MySQL is used… But at any rate, the relevant bit from hook_schema() looks like this:
$schema['domain_export'] = array(
'description' => 'Stores canonical machine names for domains.',
'fields' => array(
'domain_id' => array('type' => 'serial', 'not null' => TRUE, 'description' => 'Domain id. Automatic master key.'),
'machine_name' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', 'description' => 'The machine name for this domain.')),
'primary key' => array('machine_name'),
'indexes' => array(
'domain_id' => array('domain_id')
),
);
So yeah, since the serial field will already be the primary key, we can't make another one.
Possible patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| domain_export_multiple_primary_keys.patch | 661 bytes | Garrett Albright |
Comments
Comment #1
agentrickardOdd that MySQL doesn't seem to mind. This looks sufficient to me but I'd love to have folks with more db experience weigh in.
Comment #2
nevergoneWhat would there be need for in order for the solution of the issue to go on?
Comment #3
agentrickardConfirmation that making this change doesn't:
* Break installation
* Break update
* Break the upgrade path
We would also need an update hook.
Comment #4
agentrickardFixed.
3cf8a71..cdee6f5 7.x-3.x -> 7.x-3.xNotes:
* Does not affect < 7.x.3.
* Since this only affects installs, no update hook is provided.
Comment #5
nevergoneThanks! :)