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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

Odd 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.

nevergone’s picture

What would there be need for in order for the solution of the issue to go on?

agentrickard’s picture

Confirmation that making this change doesn't:

* Break installation
* Break update
* Break the upgrade path

We would also need an update hook.

agentrickard’s picture

Status: Needs review » Fixed

Fixed.

3cf8a71..cdee6f5 7.x-3.x -> 7.x-3.x

Notes:

* Does not affect < 7.x.3.
* Since this only affects installs, no update hook is provided.

nevergone’s picture

Thanks! :)

Status: Fixed » Closed (fixed)

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