I am getting the errors below, when running drush qd to run commerce kickstart:

You are about to create a sites/default/files directory and create a sites/default/settings.php file and CREATE  the '/Users/shrop/Sites/commercesite/commercesite.sqlite' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a few seconds ...                                [ok]
WD php: PDOException: SQLSTATE[HY000]: General error: 1 there is already a table named    [error]
message_type: CREATE INDEX main.message_type ON message (type); 
; Array
(
)
 in db_create_table() (line 2688 of
/Users/shrop/Sites/commercesite/commerce_kickstart/includes/database/database.inc).
WD php: Warning: Cannot modify header information - headers already sent by (output       [warning]
started at /usr/local/Cellar/drush/5.8/libexec/includes/output.inc:37) in
drupal_send_headers() (line 1212 of
/Users/shrop/Sites/commercesite/commerce_kickstart/includes/bootstrap.inc).
PDOException: SQLSTATE[HY000]: General error: 1 there is already a table named message_type: CREATE INDEX main.message_type ON message (type); 
; Array
(
)
 in db_create_table() (line 2688 of /Users/shrop/Sites/commercesite/commerce_kickstart/includes/database/database.inc).
Drush command terminated abnormally due to an unrecoverable error.   

The error to look for in the above text:

SQLSTATE[HY000]: General error: 1 there is already a table named message_type: CREATE INDEX main.message_type ON message (type); 
; Array
(
)
 in db_create_table() (line 2688 of /Users/shrop/Sites/commercesite/commerce_kickstart/includes/database/database.inc).

Below are the drush qd command line configs I am using. The first is the same one used as an example in the drush qd docs "drush help qd" and the second uses the -dev version of commerce kickstart:

drush qd commercesite --core=commerce_kickstart --profile=commerce_kickstart --cache --yes --watchdog
drush qd commercesite --core=commerce_kickstart --profile=commerce_kickstart --cache --yes --watchdog --dev

I really like using drush qd and am curious if others have had similar issues.

Thanks!

Comments

jsacksick’s picture

Category: bug » support
Status: Active » Fixed

It seems that you're trying to use this command on an existing install and your database is not dropped before trying to install.

General error: 1 there is already a table named message_type: [error]

I've never used this command, (I use drush si instead), why don't you run drush sql-drop before ?

mariogalan’s picture

Status: Fixed » Active

Same error here.

"Drush qd" creates a completely new installation with a new sqlite DB so there's nothing to drop.

It looks like that the message_type table is somehow created twice.

shrop’s picture

I am not installing over existing in this case. I double checked to make sure just now. Same error.

shrop’s picture

Title: drush qd command fails to build and start running commerce kickstart with with PDOException error » drush qd command fails to build and start running commerce kickstart with PDOException error

corrected grammatical issue in the title

Anthony Fok’s picture

Title: drush qd command fails to build and start running commerce kickstart with PDOException error » Commerce Kickstart installation fails at "message" module with SQLite (TABLE and INDEX both named "message_type")
Category: support » bug

I ran into the exact same problem when trying to install Commerce Kickstart v2 with SQLite over the web interface:

PDOException: SQLSTATE[HY000]: General error: 1 there is already a table named message_type:
CREATE INDEX main.message_type ON message (type);

Same problem with Drupal Commons 3.0. It turns out both distributions use the "message" module, which, when used with SQLite, triggers the bug and aborts the installation.

Since drush qd installs with the SQLite backend by default, it also manifests the same problem, and is arguably easier to debug too.

It appears that this bug is due to a limitation in SQLite where a table and an index cannot be given the same name in a database. According to http://www.sqlite.org/lang_createtable.html:

It is usually an error to attempt to create a new table in a database that already contains a table, index or view of the same name. However, if the "IF NOT EXISTS" clause is specified as part of the CREATE TABLE statement and a table or view of the same name already exists, the CREATE TABLE command simply has no effect (and no error message is returned). An error is still returned if the table cannot be created because of an existing index, even if the "IF NOT EXISTS" clause is specified.

I am relatively new to Drupal and do not yet know how to go about fixing it, but hope the above information will help set the record straight, so other Drupal experts can get it fixed. :-)

Anthony Fok’s picture

Anthony Fok’s picture

Title: Commerce Kickstart installation fails at "message" module with SQLite (TABLE and INDEX both named "message_type") » Commerce Kickstart installation fails at Message module with SQLite (TABLE and INDEX both named "message_type")
bojanz’s picture

Status: Active » Closed (duplicate)

Since this is a Message issue, let's fix it there and then pull the new release in.

bojanz’s picture

Issue summary: View changes

Added more info on the error